package org.ollide.xposed.instagram;


import org.junit.Assert;
import org.junit.Test;

public class ClassNamesTest {

    private static final int VERSION_6_10_1 = 5257472;
    private static final int VERSION_6_16_0 = 7274492;
    private static final int VERSION_6_16_1 = 7369808;
    private static final int VERSION_6_18_0 = 8031086;
    private static final int VERSION_6_19_0 = 8582325;
    private static final int VERSION_6_20_0 = 9204850;

    private static final int VERSION_PAST_UNKNOWN = 100;

    @Test
    public void getBaseActivityNameTest() {
        Assert.assertEquals("com.instagram.base.activity.e", ClassNames.getBaseActivityName());

        ClassNames.initWithVersion(VERSION_6_16_1);
        Assert.assertEquals("com.instagram.base.activity.e", ClassNames.getBaseActivityName());

        ClassNames.initWithVersion(VERSION_PAST_UNKNOWN);
        Assert.assertEquals("com.instagram.base.activity.e", ClassNames.getBaseActivityName());
    }

    @Test
    public void getDoubleTapListenerNameTest() {
        ClassNames.initWithVersion(VERSION_6_20_0);
        Assert.assertEquals("com.instagram.android.feed.a.b.bc", ClassNames.getDoubleTapListenerName());

        ClassNames.initWithVersion(VERSION_6_19_0);
        Assert.assertEquals("com.instagram.android.feed.a.b.aw", ClassNames.getDoubleTapListenerName());

        ClassNames.initWithVersion(VERSION_6_18_0);
        Assert.assertEquals("com.instagram.android.feed.a.b.at", ClassNames.getDoubleTapListenerName());

        ClassNames.initWithVersion(VERSION_6_16_1);
        Assert.assertEquals("com.instagram.android.feed.a.b.ac", ClassNames.getDoubleTapListenerName());

        ClassNames.initWithVersion(VERSION_6_16_0);
        Assert.assertEquals("com.instagram.android.feed.a.b.ac", ClassNames.getDoubleTapListenerName());

        ClassNames.initWithVersion(VERSION_6_10_1);
        Assert.assertEquals("com.instagram.android.feed.a.b.z", ClassNames.getDoubleTapListenerName());

        ClassNames.initWithVersion(VERSION_PAST_UNKNOWN);
        Assert.assertEquals("com.instagram.android.feed.a.b.z", ClassNames.getDoubleTapListenerName());
    }

    @Test
    public void getHeartIconTapListenerNameTest() {
        ClassNames.initWithVersion(VERSION_6_20_0);
        Assert.assertEquals("com.instagram.android.feed.a.b.ai", ClassNames.getHeartIconTapListenerName());

        ClassNames.initWithVersion(VERSION_6_19_0);
        Assert.assertEquals("com.instagram.android.feed.a.b.ai", ClassNames.getHeartIconTapListenerName());

        ClassNames.initWithVersion(VERSION_6_18_0);
        Assert.assertEquals("com.instagram.android.feed.a.b.af", ClassNames.getHeartIconTapListenerName());

        ClassNames.initWithVersion(VERSION_6_16_1);
        Assert.assertEquals("com.instagram.android.feed.a.b.o", ClassNames.getHeartIconTapListenerName());

        ClassNames.initWithVersion(VERSION_6_16_0);
        Assert.assertEquals("com.instagram.android.feed.a.b.o", ClassNames.getHeartIconTapListenerName());

        ClassNames.initWithVersion(VERSION_6_10_1);
        Assert.assertEquals("com.instagram.android.feed.a.b.b", ClassNames.getHeartIconTapListenerName());

        ClassNames.initWithVersion(VERSION_PAST_UNKNOWN);
        Assert.assertEquals("com.instagram.android.feed.a.b.b", ClassNames.getHeartIconTapListenerName());
    }

}

@@ -957,32 +957,93 @@
 e());%0A    %7D%0A%0A   
+ // TODO: find a better way to test different versions%0A    //
  @Test%0A    publi
@@ -1222,36 +1222,42 @@
 oubleTapListener
-Name
+Candidates
 ());%0A%0A        Cl
@@ -1386,36 +1386,42 @@
 oubleTapListener
-Name
+Candidates
 ());%0A%0A        Cl
@@ -1550,36 +1550,42 @@
 oubleTapListener
-Name
+Candidates
 ());%0A%0A        Cl
@@ -1714,36 +1714,42 @@
 oubleTapListener
-Name
+Candidates
 ());%0A%0A        Cl
@@ -1878,36 +1878,42 @@
 oubleTapListener
-Name
+Candidates
 ());%0A%0A        Cl
@@ -2041,36 +2041,42 @@
 oubleTapListener
-Name
+Candidates
 ());%0A%0A        Cl
@@ -2210,36 +2210,42 @@
 oubleTapListener
-Name
+Candidates
 ());%0A    %7D%0A%0A    
@@ -2240,24 +2240,84 @@
 %0A    %7D%0A%0A    
+// TODO: find a better way to test different versions%0A    //
 @Test%0A    pu
@@ -2505,36 +2505,42 @@
 tIconTapListener
-Name
+Candidates
 ());%0A%0A        Cl
@@ -2672,36 +2672,42 @@
 tIconTapListener
-Name
+Candidates
 ());%0A%0A        Cl
@@ -2839,36 +2839,42 @@
 tIconTapListener
-Name
+Candidates
 ());%0A%0A        Cl
@@ -3005,36 +3005,42 @@
 tIconTapListener
-Name
+Candidates
 ());%0A%0A        Cl
@@ -3171,36 +3171,42 @@
 tIconTapListener
-Name
+Candidates
 ());%0A%0A        Cl
@@ -3341,28 +3341,34 @@
 nTapListener
-Name
+Candidates
 ());%0A%0A      
@@ -3517,20 +3517,26 @@
 Listener
-Name
+Candidates
 ());%0A   

version tests don't work for now...