Hinzufügen von Test zu IntermediateRefTypeTest und IntermediateGenericTypeTest.

This commit is contained in:
Etienne Zink 2022-03-20 16:34:01 +01:00
parent 55a75b04a0
commit 8b58259fe0
2 changed files with 56 additions and 8 deletions

View File

@ -1,11 +1,59 @@
package intermediate.types;
import org.junit.Assert;
import de.dhbwstuttgart.intermediate.types.IntermediateGenericType;
import de.dhbwstuttgart.intermediate.types.IntermediateRefType;
import de.dhbwstuttgart.parser.scope.JavaClassName;
import org.junit.BeforeClass;
import org.junit.Test;
import org.objectweb.asm.Type;
import static org.junit.Assert.assertEquals;
public class IntermediateGenericTypeTest {
@Test
public void ToDo(){
Assert.fail();
private static String tSignature;
private static String tDescriptor;
private static IntermediateGenericType t;
private static String sExtendsStringSignature;
private static String sExtendsStringDescriptor;
private static IntermediateGenericType sExtendsString;
private static String rExtendsSSignature;
private static String rExtendsSDescriptor;
private static IntermediateGenericType rExtendsS;
@BeforeClass
public static void StartUp(){
tSignature = "TT;";
tDescriptor = "Ljava/lang/Object;";
t = new IntermediateGenericType("T");
sExtendsStringSignature = "TS;";
sExtendsStringDescriptor = "Ljava/lang/String;";
sExtendsString = new IntermediateGenericType("S",
new IntermediateRefType(new JavaClassName(Type.getInternalName(String.class))));
rExtendsSSignature = "TR;";
rExtendsSDescriptor = sExtendsStringDescriptor;
rExtendsS = new IntermediateGenericType("R", sExtendsString);
}
@Test
public void SignatureTest_T(){ assertEquals(tSignature, t.getSignature()); }
@Test
public void DescriptorTest_T(){ assertEquals(tDescriptor, t.getDescriptor()); }
@Test
public void SignatureTest_TExtendsString(){ assertEquals(sExtendsStringSignature, sExtendsString.getSignature()); }
@Test
public void DescriptorTest_TExtendsString(){ assertEquals(sExtendsStringDescriptor, sExtendsString.getDescriptor()); }
@Test
public void SignatureTest_TExtendsS(){ assertEquals(rExtendsSSignature, rExtendsS.getSignature()); }
@Test
public void DescriptorTest_TExtendsS(){ assertEquals(rExtendsSDescriptor, rExtendsS.getDescriptor()); }
}

View File

@ -20,7 +20,7 @@ public class IntermediateRefTypeTest {
private static String listOfIntegerSignature;
private static String listOfIntegerDescriptor;
private static IntermediateRefType typeToTest_ListofInteger;
private static IntermediateRefType typeToTest_ListOfInteger;
private static String voidSignature;
private static String voidDescriptor;
@ -34,7 +34,7 @@ public class IntermediateRefTypeTest {
listOfIntegerSignature = "Ljava/util/List<Ljava/lang/Integer;>;";
listOfIntegerDescriptor = "Ljava/util/List;";
typeToTest_ListofInteger = new IntermediateRefType(
typeToTest_ListOfInteger = new IntermediateRefType(
new JavaClassName(Type.getInternalName(List.class)),
Arrays.asList(typeToTest_Integer));
@ -54,10 +54,10 @@ public class IntermediateRefTypeTest {
}
@Test
public void SignatureTest_List(){ assertEquals(listOfIntegerSignature, typeToTest_ListofInteger.getSignature()); }
public void SignatureTest_List(){ assertEquals(listOfIntegerSignature, typeToTest_ListOfInteger.getSignature()); }
@Test
public void DescriptorTest_List(){ assertEquals(listOfIntegerDescriptor, typeToTest_ListofInteger.getDescriptor()); }
public void DescriptorTest_List(){ assertEquals(listOfIntegerDescriptor, typeToTest_ListOfInteger.getDescriptor()); }
@Test
public void SignatureTest_Void(){