package org.sfm.reflect.asm;

import org.junit.Test;
import org.sfm.beans.DbObject;

import java.io.InputStream;
import java.sql.ResultSet;

import static org.junit.Assert.*;


public class InstantiatorKeyTest {

    @Test
    public void testEqualsOnSameKey() throws NoSuchMethodException {
        InstantiatorKey k = new InstantiatorKey(DbObject.class, ResultSet.class);
        assertTrue(k.equals(k));
    }

    @Test
    public void testEqualsOnSameSourceAndTargetValues() throws NoSuchMethodException {
        InstantiatorKey k1 = new InstantiatorKey(DbObject.class, ResultSet.class);
        InstantiatorKey k2 = new InstantiatorKey(DbObject.class, ResultSet.class);
        assertTrue(k1.equals(k2));
    }

    @Test
    public void testNotEqualsOnDiffSourceAndSameTargetValues() throws NoSuchMethodException {
        InstantiatorKey k1 = new InstantiatorKey(DbObject.class, ResultSet.class);
        InstantiatorKey k2 = new InstantiatorKey(DbObject.class, InputStream.class);
        InstantiatorKey k3 = new InstantiatorKey(DbObject.class, null);
        assertFalse(k1.equals(k2));
        assertFalse(k1.equals(k3));
        assertFalse(k3.equals(k1));
    }

    @Test
    public void testNotEqualsOnNull() throws NoSuchMethodException {
        InstantiatorKey k1 = new InstantiatorKey(DbObject.class, ResultSet.class);
        assertFalse(k1.equals(null));
    }

    @Test
    public void testNotEqualsOnDiffClass() throws NoSuchMethodException {
        InstantiatorKey k1 = new InstantiatorKey(DbObject.class, ResultSet.class);
        assertFalse(k1.equals(new Object()));
    }

}
@@ -46,16 +46,52 @@
 t.Test;%0A
+import org.sfm.beans.DbFinalObject;%0A
 import o
@@ -782,319 +782,1880 @@
 test
-NotEqualsOnDiffSourceAndSameTargetValues() throws NoSuchMethodException %7B%0A        InstantiatorKey k1 = new InstantiatorKey(DbObject.class, ResultSet.class);%0A        InstantiatorKey k2 = new InstantiatorKey(DbObject.class, InputStream.class);%0A        InstantiatorKey k3 = new InstantiatorKey(DbObject.class, null
+EqualsOnSameSourceAndTargetAndInjectParamValues() throws NoSuchMethodException %7B%0A        InstantiatorKey k1 = new InstantiatorKey(DbObject.class.getConstructor(), new String%5B%5D %7B %22param%22%7D, ResultSet.class);%0A        InstantiatorKey k2 = new InstantiatorKey(DbObject.class.getConstructor(), new String%5B%5D %7B %22param%22%7D, ResultSet.class);%0A        assertTrue(k1.equals(k2));%0A    %7D%0A%0A    @Test%0A    public void testNotEqualsOnDiffSourceAndSameTargetValues() throws NoSuchMethodException %7B%0A        InstantiatorKey k1 = new InstantiatorKey(DbObject.class, ResultSet.class);%0A        InstantiatorKey k2 = new InstantiatorKey(DbObject.class, InputStream.class);%0A        InstantiatorKey k3 = new InstantiatorKey(DbObject.class, null);%0A        assertFalse(k1.equals(k2));%0A        assertFalse(k1.equals(k3));%0A        assertFalse(k3.equals(k1));%0A    %7D%0A%0A    @Test%0A    public void testNotEqualsOnSameSourceAndTargetAndDiffInjectParamValues() throws NoSuchMethodException %7B%0A        InstantiatorKey k1 = new InstantiatorKey(DbObject.class.getConstructor(), new String%5B%5D %7B %22param%22%7D, ResultSet.class);%0A        InstantiatorKey k2 = new InstantiatorKey(DbObject.class.getConstructor(), new String%5B%5D %7B %22param2%22%7D, ResultSet.class);%0A        InstantiatorKey k3 = new InstantiatorKey(DbObject.class.getConstructor(), null, ResultSet.class);%0A        assertFalse(k1.equals(k2));%0A        assertFalse(k1.equals(k3));%0A        assertFalse(k3.equals(k1));%0A    %7D%0A%0A    @Test%0A    public void testNotEqualsDiffConstructor() throws NoSuchMethodException %7B%0A        InstantiatorKey k1 = new InstantiatorKey(DbObject.class.getConstructor(), new String%5B%5D %7B %22param%22%7D, ResultSet.class);%0A        InstantiatorKey k2 = new InstantiatorKey(DbFinalObject.class.getDeclaredConstructors()%5B0%5D, new String%5B%5D %7B %22param%22%7D, ResultSet.class);%0A        InstantiatorKey k3 = new InstantiatorKey(null, new String%5B%5D %7B %22param%22%7D, ResultSet.class
 );%0A 

add test for key equals