Skip to content

Commit 04e07f2

Browse files
committed
Add failing tests for #51 and #53
1 parent e494d15 commit 04e07f2

File tree

4 files changed

+55
-10
lines changed

4 files changed

+55
-10
lines changed

pom.xml

+9-2
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ com.fasterxml.classmate.*;version=${project.version}
100100
<artifactId>maven-javadoc-plugin</artifactId>
101101
<configuration>
102102
<source>${version.jdk}</source>
103-
<target>${version.jdk}</target>
104103
<encoding>UTF-8</encoding>
105104
<links>
106105
<link>https://docs.oracle.com/javase/8/docs/api/</link>
@@ -160,7 +159,15 @@ com.fasterxml.classmate.*;version=${project.version}
160159
</execution>
161160
</executions>
162161
</plugin>
163-
162+
<plugin>
163+
<groupId>org.apache.maven.plugins</groupId>
164+
<artifactId>maven-surefire-plugin</artifactId>
165+
<configuration>
166+
<excludes>
167+
<exclude>**/failing/*.java</exclude>
168+
</excludes>
169+
</configuration>
170+
</plugin>
164171
</plugins>
165172
</build>
166173
<profiles>

src/test/java/com/fasterxml/classmate/TestTypeResolver.java

+2-8
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,8 @@ static class HashTree<K, V> extends HashMap<K, HashTree<K, V>> { }
8181
/**********************************************************************
8282
*/
8383

84-
protected TypeResolver typeResolver;
85-
86-
@Override
87-
protected void setUp()
88-
{
89-
// Let's use a single instance for all tests, to increase chance of seeing failures
90-
typeResolver = new TypeResolver();
91-
}
84+
// Let's use a single instance for all tests, to increase chance of seeing failures
85+
protected final TypeResolver typeResolver = new TypeResolver();
9286

9387
/*
9488
/**********************************************************************
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package com.fasterxml.classmate.failing;
2+
3+
import com.fasterxml.classmate.BaseTest;
4+
import com.fasterxml.classmate.ResolvedType;
5+
import com.fasterxml.classmate.TypeResolver;
6+
7+
public class ArrayTypeResolution51Test extends BaseTest
8+
{
9+
protected final TypeResolver RESOLVER = new TypeResolver();
10+
11+
// [classmate#51]: parent type for Array classes
12+
public void testResolvingRawType() {
13+
ResolvedType rt = RESOLVER.resolve(Long[].class);
14+
ResolvedType parent = rt.getParentClass();
15+
assertNotNull(parent);
16+
assertEquals(Long.class, parent.getErasedType());
17+
}
18+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.fasterxml.classmate.failing;
2+
3+
import java.util.Arrays;
4+
import java.util.Comparator;
5+
import java.util.List;
6+
7+
import com.fasterxml.classmate.BaseTest;
8+
import com.fasterxml.classmate.ResolvedType;
9+
import com.fasterxml.classmate.TypeResolver;
10+
11+
// for [classmate#53]: Raw Comparator
12+
public class TestTypeResolver53 extends BaseTest
13+
{
14+
@SuppressWarnings("rawtypes")
15+
static abstract class Comparator53 implements Comparator { }
16+
17+
protected final TypeResolver RESOLVER = new TypeResolver();
18+
19+
// [classmate#53] Problem with Raw types
20+
public void testResolvingRawType() {
21+
ResolvedType rt = RESOLVER.resolve(Comparator53.class);
22+
List<ResolvedType> params = rt.typeParametersFor(Comparator.class);
23+
assertEquals(Arrays.asList(RESOLVER.resolve(Object.class)),
24+
params);
25+
}
26+
}

0 commit comments

Comments
 (0)