Code example for Constructor

Methods: toGenericString, toString

0
    } 
 
    public void testConstructorToString() throws Exception { 
        Constructor constructorOne = C.class.getDeclaredConstructor(A.class);
        String constructorOneRaw = classC + "(" + classA + ") throws " + classB;
        assertEquals(constructorOneRaw, constructorOne.toString());
        assertEquals(constructorOneRaw, constructorOne.toGenericString());
 
        Constructor constructorTwo = C.class.getDeclaredConstructor(Map.class, Object.class);
        String constructorTwoRaw = "protected " + classC + "(java.util.Map,java.lang.Object)";
        assertEquals(constructorTwoRaw, constructorTwo.toString());
        String constructorTwoGeneric = "protected <T1> " + classC
                + "(java.util.Map<? super " + classA + ", T1>,K)";
        assertEquals(constructorTwoGeneric, constructorTwo.toGenericString());
    } 
 
    public void testMethodToString() throws Exception { 
        Method methodOne = C.class.getDeclaredMethod("methodOne", A.class, C.class);
        String methodOneRaw = "protected final synchronized " + classA + " "
                + classC + ".methodOne(" + classA + "," + classC + ") throws " + classB;
        assertEquals(methodOneRaw, methodOne.toString());