-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved GenericTypeDeterminer to core package, only used there Moved ConstructorArguments to strategy package, only used there
- Loading branch information
1 parent
7b45833
commit 3787c8f
Showing
14 changed files
with
102 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...anmapper/utils/GenericTypeDeterminer.java → ...eanmapper/core/GenericTypeDeterminer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...eanmapper/utils/ConstructorArguments.java → ...mapper/strategy/ConstructorArguments.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package io.beanmapper.utils; | ||
package io.beanmapper.strategy; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package io.beanmapper.utils; | ||
|
||
import org.junit.Test; | ||
|
||
public class CheckTest { | ||
|
||
@Test | ||
public void construct() { | ||
// codecov expects a util class to be constructed | ||
new Check(); | ||
new Classes(); | ||
new DefaultValues(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package io.beanmapper.utils; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
import java.util.List; | ||
|
||
import org.junit.Test; | ||
|
||
public class ClassesTest { | ||
|
||
@Test(expected = IllegalArgumentException.class) | ||
public void nonExistingClass() { | ||
Classes.forName("a.b.c.DoesNotExist"); | ||
} | ||
|
||
@Test | ||
public void genericTypeOfClassWithGenericType() { | ||
ClassWithGeneric source = new ClassWithGeneric(); | ||
assertEquals(String.class, source.getType()); | ||
} | ||
|
||
@Test | ||
public void genericTypeOfClassWithoutGenericType() { | ||
ClassWithNestedGeneric source = new ClassWithNestedGeneric(); | ||
assertEquals(List.class, source.getType()); | ||
} | ||
|
||
public static class AbstractClassWithGeneric<C> { | ||
private final Class<C> type; | ||
public AbstractClassWithGeneric() { | ||
this.type = (Class<C>)Classes.getParameteredTypes(getClass())[0]; | ||
} | ||
public Class<C> getType() { return type; } | ||
} | ||
|
||
public static class ClassWithGeneric extends AbstractClassWithGeneric<String> { | ||
} | ||
|
||
public static class ClassWithNestedGeneric extends AbstractClassWithGeneric<List<String>> { | ||
} | ||
} |