Skip to content

Commit

Permalink
Add failing tests for #51 and #53
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Nov 16, 2023
1 parent e494d15 commit 04e07f2
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 10 deletions.
11 changes: 9 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ com.fasterxml.classmate.*;version=${project.version}
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<source>${version.jdk}</source>
<target>${version.jdk}</target>
<encoding>UTF-8</encoding>
<links>
<link>https://docs.oracle.com/javase/8/docs/api/</link>
Expand Down Expand Up @@ -160,7 +159,15 @@ com.fasterxml.classmate.*;version=${project.version}
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<excludes>
<exclude>**/failing/*.java</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
Expand Down
10 changes: 2 additions & 8 deletions src/test/java/com/fasterxml/classmate/TestTypeResolver.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,8 @@ static class HashTree<K, V> extends HashMap<K, HashTree<K, V>> { }
/**********************************************************************
*/

protected TypeResolver typeResolver;

@Override
protected void setUp()
{
// Let's use a single instance for all tests, to increase chance of seeing failures
typeResolver = new TypeResolver();
}
// Let's use a single instance for all tests, to increase chance of seeing failures
protected final TypeResolver typeResolver = new TypeResolver();

/*
/**********************************************************************
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.fasterxml.classmate.failing;

import com.fasterxml.classmate.BaseTest;
import com.fasterxml.classmate.ResolvedType;
import com.fasterxml.classmate.TypeResolver;

public class ArrayTypeResolution51Test extends BaseTest
{
protected final TypeResolver RESOLVER = new TypeResolver();

// [classmate#51]: parent type for Array classes
public void testResolvingRawType() {
ResolvedType rt = RESOLVER.resolve(Long[].class);
ResolvedType parent = rt.getParentClass();
assertNotNull(parent);
assertEquals(Long.class, parent.getErasedType());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.fasterxml.classmate.failing;

import java.util.Arrays;
import java.util.Comparator;
import java.util.List;

import com.fasterxml.classmate.BaseTest;
import com.fasterxml.classmate.ResolvedType;
import com.fasterxml.classmate.TypeResolver;

// for [classmate#53]: Raw Comparator
public class TestTypeResolver53 extends BaseTest
{
@SuppressWarnings("rawtypes")
static abstract class Comparator53 implements Comparator { }

protected final TypeResolver RESOLVER = new TypeResolver();

// [classmate#53] Problem with Raw types
public void testResolvingRawType() {
ResolvedType rt = RESOLVER.resolve(Comparator53.class);
List<ResolvedType> params = rt.typeParametersFor(Comparator.class);
assertEquals(Arrays.asList(RESOLVER.resolve(Object.class)),
params);
}
}

0 comments on commit 04e07f2

Please sign in to comment.