-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
nbauma109
committed
May 21, 2023
1 parent
ba9fddc
commit dd48b2d
Showing
1 changed file
with
51 additions
and
0 deletions.
There are no files selected for viewing
51 changes: 51 additions & 0 deletions
51
src/test/java/org/jd/core/v1/model/javasyntax/declaration/InterfaceDeclarationTest.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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package org.jd.core.v1.model.javasyntax.declaration; | ||
|
||
import org.apache.bcel.Const; | ||
import org.jd.core.v1.model.javasyntax.type.ObjectType; | ||
import org.jd.core.v1.model.javasyntax.type.Types; | ||
import org.jd.core.v1.service.converter.classfiletojavasyntax.visitor.TestDeclarationVisitor; | ||
import org.jd.core.v1.util.StringConstants; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertNull; | ||
|
||
public class InterfaceDeclarationTest { | ||
|
||
private InterfaceDeclaration interfaceDeclaration; | ||
private TestDeclarationVisitor visitor; | ||
|
||
@Before | ||
public void setUp() { | ||
ObjectType cloneableType = new ObjectType(StringConstants.JAVA_LANG_CLONEABLE, "java.lang.Cloneable", "Cloneable"); | ||
ObjectType stringType = new ObjectType(StringConstants.JAVA_LANG_STRING, "java.lang.String", "String"); | ||
ObjectType listType = new ObjectType("java/util/List", "java.util.List", "List", stringType); | ||
|
||
interfaceDeclaration = new InterfaceDeclaration( | ||
Const.ACC_PUBLIC, | ||
"org/jd/core/v1/service/test/InterfaceTest", | ||
"InterfaceTest", | ||
new Types(listType, cloneableType) | ||
); | ||
|
||
visitor = new TestDeclarationVisitor(); | ||
} | ||
|
||
@Test | ||
public void testInterfaceDeclaration() { | ||
// Act | ||
interfaceDeclaration.accept(visitor); | ||
|
||
// Assert | ||
assertEquals(1, visitor.getInterfaceDeclarationCount()); | ||
assertNull(interfaceDeclaration.getTypeParameters()); | ||
assertEquals(2, ((Types)interfaceDeclaration.getInterfaces()).size()); | ||
} | ||
|
||
@Test | ||
public void testToString() { | ||
// Act & Assert | ||
assertEquals("InterfaceDeclaration{org/jd/core/v1/service/test/InterfaceTest}", interfaceDeclaration.toString()); | ||
} | ||
} |