10000 Added tests project, libraries and config. · randomcoding/JavaUtilities@b964ec4 · GitHub
[go: up one dir, main page]

Skip to content

Commit b964ec4

Browse files
author
Tym the Enchanter
committed
Added tests project, libraries and config.
0 parents  commit b964ec4

File tree

9 files changed

+139
-0
lines changed

9 files changed

+139
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry exported="true" kind="lib" path="libs/hamcrest-all-1.2.jar"/>
4+
<classpathentry exported="true" kind="lib" path="libs/junit-4.8.1.jar"/>
5+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
6+
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
7+
<classpathentry kind="src" path="tests"/>
8+
<classpathentry kind="output" path="bin"/>
9+
</classpath>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>RandomCodingJavaUtilitiesTests</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>org.eclipse.pde.ManifestBuilder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
<buildCommand>
19+
<name>org.eclipse.pde.SchemaBuilder</name>
20+
<arguments>
21+
</arguments>
22+
</buildCommand>
23+
</buildSpec>
24+
<natures>
25+
<nature>org.eclipse.pde.PluginNature</nature>
26+
<nature>org.eclipse.jdt.core.javanature</nature>
27+
</natures>
28+
</projectDescription>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#Sat Jun 05 15:57:01 BST 2010
2+
eclipse.preferences.version=1
3+
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
4+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
5+
org.eclipse.jdt.core.compiler.compliance=1.6
6+
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
7+
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
8+
org.eclipse.jdt.core.compiler.source=1.6
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Manifest-Version: 1.0
2+
Bundle-ManifestVersion: 2
3+
Bundle-Name: RandomCoding Java Utilities Tests
4+
Bundle-SymbolicName: uk.co.randomcoding.common.JavaUtilitiesTests
5+
Bundle-Version: 1.0.0.qualifier
6+
Bundle-Vendor: Tym the Enchanter <tymtheenchanter@randomcoding.co.uk>
7+
Fragment-Host: uk.co.randomcoding.common.JavaUtilities;bundle-version="1.0.0"
8+
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
9+
Bundle-ClassPath: libs/hamcrest-all-1.2.jar,
10+
libs/junit-4.8.1.jar,
11+
.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
source.. = tests/
2+
output.. = bin/
3+
bin.includes = META-INF/,\
4+
.,\
5+
libs/hamcrest-all-1.2.jar,\
6+
libs/junit-4.8.1.jar
Binary file not shown.
Binary file not shown.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
3+
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
4+
<listEntry value="/RandomCodingJavaUtilitiesTests"/>
5+
</listAttribute>
6+
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
7+
<listEntry value="4"/>
8+
</listAttribute>
9+
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value="=RandomCodingJavaUtilitiesTests"/>
10+
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
11+
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
12+
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
13+
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value=""/>
14+
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="RandomCodingJavaUtilitiesTests"/>
15+
</launchConfiguration>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
/*
2+
* (c) Tym The Enchanter (tymtheenchanter@randomcoding.co.uk), 5 Jun 2010
3+
*/
4+
package uk.co.randomcoding.java.util.collection;
5+
6+
import static org.hamcrest.MatcherAssert.assertThat;
7+
import static org.hamcrest.Matchers.hasSize;
8+
9+
import java.util.Collection;
10+
import java.util.HashSet;
11+
12+
import org.hamcrest.Matchers;
13+
import org.junit.Test;
14+
15+
/**
16+
* Created on: 5 Jun 2010<br>
17+
*
18+
* @author Tym the Enchanter <tymtheenchanter@randomcoding.co.uk>
19+
*/
20+
public class TypedCollectionUtilitiesTest
21+
{
22+
@Test
23+
public void testExtractTypedCollection() throws Exception
24+
{
25+
Collection<TestClass> testCollection = new HashSet<TypedCollectionUtilitiesTest.TestClass>();
26+
testCollection.add(new TestClass());
27+
testCollection.add(new TestClass());
28+
testCollection.add(new TestSubClass());
29+
testCollection.add(new TestSubClass());
30+
testCollection.add(new TestSubSubClass());
31+
testCollection.add(new TestSubSubClass());
32+
33+
assertThat(TypedCollectionUtilities.extractTypedCollection(testCollection, TestSubClass.class), hasSize(4));
34+
assertThat(TypedCollectionUtilities.extractTypedCollection(testCollection, TestSubSubClass.class), hasSize(2));
35+
assertThat(TypedCollectionUtilities.extractTypedCollection(testCollection, OtherTestClass.class), Matchers.<OtherTestClass> empty());
36+
}
37+
38+
private static class TestClass
39+
{
40+
// empty class
41+
}
42+
43+
private static class TestSubClass extends TestClass
44+
{
45+
// empty class
46+
}
47+
48+
private static class TestSubSubClass extends TestSubClass
49+
{
50+
// empty class
51+
}
52+
53+
private static class OtherTestClass
54+
{
55+
// empty class
56+
}
57+
58+
private static class OtherTestSubClass extends OtherTestClass
59+
{
60+
// empty class
61+
}
62+
}

0 commit comments

Comments
 (0)
0