Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added documentation and test coverage.
- Loading branch information
Showing
6 changed files
with
132 additions
and
31 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 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
81 changes: 81 additions & 0 deletions
81
...rc/test/java/net/bytebuddy/description/type/TypeDescriptionForPackageDescriptionTest.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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,81 @@ | |||
package net.bytebuddy.description.type; | |||
|
|||
import net.bytebuddy.description.annotation.AnnotationList; | |||
import net.bytebuddy.description.type.generic.GenericTypeDescription; | |||
import net.bytebuddy.test.utility.MockitoRule; | |||
import org.junit.Before; | |||
import org.junit.Rule; | |||
import org.junit.Test; | |||
import org.junit.rules.TestRule; | |||
import org.mockito.Mock; | |||
|
|||
import static org.hamcrest.CoreMatchers.is; | |||
import static org.hamcrest.MatcherAssert.assertThat; | |||
import static org.mockito.Mockito.mock; | |||
import static org.mockito.Mockito.when; | |||
|
|||
public class TypeDescriptionForPackageDescriptionTest { | |||
|
|||
private static final String FOO = "foo"; | |||
|
|||
@Rule | |||
public TestRule mockitoRule = new MockitoRule(this); | |||
|
|||
private TypeDescription typeDescription; | |||
|
|||
@Mock | |||
private PackageDescription packageDescription; | |||
|
|||
@Before | |||
public void setUp() throws Exception { | |||
typeDescription = new TypeDescription.ForPackageDescription(packageDescription); | |||
} | |||
|
|||
@Test | |||
public void testName() throws Exception { | |||
when(packageDescription.getName()).thenReturn(FOO); | |||
assertThat(typeDescription.getName(), is(FOO + "." + PackageDescription.PACKAGE_CLASS_NAME)); | |||
} | |||
|
|||
@Test | |||
public void testModifiers() throws Exception { | |||
assertThat(typeDescription.getModifiers(), is(PackageDescription.PACKAGE_MODIFIERS)); | |||
} | |||
|
|||
@Test | |||
public void testInterfaces() throws Exception { | |||
assertThat(typeDescription.getInterfaces().size(), is(0)); | |||
} | |||
|
|||
@Test | |||
public void testAnnotations() throws Exception { | |||
AnnotationList annotationList = mock(AnnotationList.class); | |||
when(packageDescription.getDeclaredAnnotations()).thenReturn(annotationList); | |||
assertThat(typeDescription.getDeclaredAnnotations(), is(annotationList)); | |||
} | |||
|
|||
@Test | |||
public void testTypeVariables() throws Exception { | |||
assertThat(typeDescription.getTypeVariables().size(), is(0)); | |||
} | |||
|
|||
@Test | |||
public void testFields() throws Exception { | |||
assertThat(typeDescription.getDeclaredFields().size(), is(0)); | |||
} | |||
|
|||
@Test | |||
public void testMethods() throws Exception { | |||
assertThat(typeDescription.getDeclaredMethods().size(), is(0)); | |||
} | |||
|
|||
@Test | |||
public void testPackage() throws Exception { | |||
assertThat(typeDescription.getPackage(), is(packageDescription)); | |||
} | |||
|
|||
@Test | |||
public void testSuperType() throws Exception { | |||
assertThat(typeDescription.getSuperType(), is((GenericTypeDescription) TypeDescription.OBJECT)); | |||
} | |||
} |