import com.timotuominen.app.utils.SubscriptionAnnotationUtils;
import com.timotuominen.app.utils.Unsubscribable;

import junit.framework.TestCase;


/**
 * Created by ttuo on 12/25/13.
 */
public class SubscriptionAnnotationUtilsTest extends TestCase {
    public void testUnsubscribeAllAnnotated() {
        AnnotationTest annotationTest = new AnnotationTest();
        SubscriptionAnnotationUtils.unsubscribeAllAnnotated(annotationTest);
        assertEquals(true, annotationTest.testVariable.unsubscribed);
    }

    public static class AnnotationTest {
        public AnnotationTest() { }

        @Unsubscribable
        final public UnsubscribeOnceTest testVariable = new UnsubscribeOnceTest();
    }

    public static class UnsubscribeOnceTest {
        public boolean unsubscribed = false;
        
        public void unsubscribe() {
            if (!unsubscribed) {
                unsubscribed = true;
            } else {
                fail("Unsubscribe called more than once!");
            }
        }
    }
}

@@ -487,16 +487,160 @@
 Variable
+1.unsubscribed);%0A        assertEquals(true, annotationTest.testVariable2.unsubscribed);%0A        assertEquals(false, annotationTest.testVariable3
 .unsubsc
@@ -809,16 +809,211 @@
 Variable
+1 = new UnsubscribeOnceTest();%0A%0A        @Unsubscribable%0A        final public UnsubscribeOnceTest testVariable2 = new UnsubscribeOnceTest();%0A%0A        final public UnsubscribeOnceTest testVariable3
  = new U
@@ -1132,24 +1132,16 @@
  false;%0A
-        
 %0A       

Add more annotation tests.