// Path: storebox-harness/src/androidTest/java/net/orange_box/storebox/harness/base/PreferencesTestCase.java
// public abstract class PreferencesTestCase<T> extends InstrumentationTestCase {
// 
//     protected T uut;
//     private SharedPreferences prefs;
// 
//     protected abstract Class<T> getInterface();
//     
//     @Override
//     protected void setUp() throws Exception {
//         super.setUp();
// 
//         uut = StoreBox.create(
//                 getInstrumentation().getTargetContext(),
//                 getInterface());
// 
//         prefs = PreferenceManager.getDefaultSharedPreferences(
//                 getInstrumentation().getTargetContext());
//     }
// 
//     @SuppressLint("CommitPrefEdits")
//     @Override
//     protected void tearDown() throws Exception {
//         uut = null;
// 
//         // we are saving to the actual preferences so let's clear them
//         prefs.edit().clear().commit();
//         prefs = null;
//         
//         super.tearDown();
//     }
// }
// 
// Path: storebox-harness/src/main/java/net/orange_box/storebox/harness/interfaces/changes/ChangeListenersInterface.java
// public interface ChangeListenersInterface {
//     
//     @KeyByString("key_int")
//     void setInt(int value);
//     
//     @KeyByString("key_int")
//     @RegisterChangeListenerMethod
//     void registerIntChangeListener(
//             OnPreferenceValueChangedListener<Integer> listener);
// 
//     @KeyByString("key_int")
//     @RegisterChangeListenerMethod
//     void registerIntChangeListenerVarArgs(
//             OnPreferenceValueChangedListener<Integer>... listeners);
// 
//     @KeyByString("key_int")
//     @UnregisterChangeListenerMethod
//     void unregisterIntChangeListener(
//             OnPreferenceValueChangedListener<Integer> listener);
// 
//     @KeyByString("key_int")
//     @UnregisterChangeListenerMethod
//     void unregisterIntChangeListenerVarArgs(
//             OnPreferenceValueChangedListener<Integer>... listeners);
//     
// 
//     @KeyByString("key_custom_class")
//     @TypeAdapter(CustomClassTypeAdapter.class)
//     void setCustomClass(CustomClass value);
// 
//     @KeyByString("key_custom_class")
//     @RegisterChangeListenerMethod
//     @TypeAdapter(CustomClassTypeAdapter.class)
//     void registerCustomClassChangeListener(
//             OnPreferenceValueChangedListener<CustomClass> listener);
// 
//     @KeyByString("key_custom_class")
//     @UnregisterChangeListenerMethod
//     @TypeAdapter(CustomClassTypeAdapter.class)
//     void unregisterCustomClassChangeListener(
//             OnPreferenceValueChangedListener<CustomClass> listener);
// }
// 
// Path: storebox-harness/src/main/java/net/orange_box/storebox/harness/types/CustomClass.java
// public class CustomClass {
//     
//     private int hashCode;
//     
//     private final String one;
//     private final String two;
//     
//     public CustomClass() {
//         this("", "");
//     }
//     
//     public CustomClass(String one, String two) {
//         this.one = one;
//         this.two = two;
//     }
//     
//     public String getOne() {
//         return one;
//     }
//     
//     public String getTwo() {
//         return two;
//     }
// 
//     @Override
//     public boolean equals(Object o) {
//         if (o == null || !(o instanceof CustomClass)) {
//             return false;
//         }
//         
//         final CustomClass other = (CustomClass) o;
//         return (one.equals(other.one) && two.equals(other.two));
//     }
// 
//     @Override
//     public int hashCode() {
//         if (hashCode == 0) {
//             hashCode = Arrays.hashCode(new String[] {one, two});
//         }
//         
//         return hashCode;
//     }
// }
// 
// Path: storebox-lib/src/main/java/net/orange_box/storebox/listeners/OnPreferenceValueChangedListener.java
// public interface OnPreferenceValueChangedListener<T> {
//     
//     void onChanged(T newValue);
// }


import android.test.UiThreadTest;
import android.test.suitebuilder.annotation.SmallTest;
import net.orange_box.storebox.harness.base.PreferencesTestCase;
import net.orange_box.storebox.harness.interfaces.changes.ChangeListenersInterface;
import net.orange_box.storebox.harness.types.CustomClass;
import net.orange_box.storebox.listeners.OnPreferenceValueChangedListener;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
/*
 * Copyright 2015 Martin Bella
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *     http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package net.orange_box.storebox.harness.changes;




public class ChangesListenersTestCase extends
        PreferencesTestCase<ChangeListenersInterface> {

    @Override
    protected Class<ChangeListenersInterface> getInterface() {
        return ChangeListenersInterface.class;
    }
    
    @UiThreadTest
    @SmallTest
    public void testIntChanged() {
        final AtomicInteger value = new AtomicInteger(-1);
// Path: storebox-harness/src/androidTest/java/net/orange_box/storebox/harness/base/PreferencesTestCase.java
// public abstract class PreferencesTestCase<T> extends InstrumentationTestCase {
// 
//     protected T uut;
//     private SharedPreferences prefs;
// 
//     protected abstract Class<T> getInterface();
//     
//     @Override
//     protected void setUp() throws Exception {
//         super.setUp();
// 
//         uut = StoreBox.create(
//                 getInstrumentation().getTargetContext(),
//                 getInterface());
// 
//         prefs = PreferenceManager.getDefaultSharedPreferences(
//                 getInstrumentation().getTargetContext());
//     }
// 
//     @SuppressLint("CommitPrefEdits")
//     @Override
//     protected void tearDown() throws Exception {
//         uut = null;
// 
//         // we are saving to the actual preferences so let's clear them
//         prefs.edit().clear().commit();
//         prefs = null;
//         
//         super.tearDown();
//     }
// }
// 
// Path: storebox-harness/src/main/java/net/orange_box/storebox/harness/interfaces/changes/ChangeListenersInterface.java
// public interface ChangeListenersInterface {
//     
//     @KeyByString("key_int")
//     void setInt(int value);
//     
//     @KeyByString("key_int")
//     @RegisterChangeListenerMethod
//     void registerIntChangeListener(
//             OnPreferenceValueChangedListener<Integer> listener);
// 
//     @KeyByString("key_int")
//     @RegisterChangeListenerMethod
//     void registerIntChangeListenerVarArgs(
//             OnPreferenceValueChangedListener<Integer>... listeners);
// 
//     @KeyByString("key_int")
//     @UnregisterChangeListenerMethod
//     void unregisterIntChangeListener(
//             OnPreferenceValueChangedListener<Integer> listener);
// 
//     @KeyByString("key_int")
//     @UnregisterChangeListenerMethod
//     void unregisterIntChangeListenerVarArgs(
//             OnPreferenceValueChangedListener<Integer>... listeners);
//     
// 
//     @KeyByString("key_custom_class")
//     @TypeAdapter(CustomClassTypeAdapter.class)
//     void setCustomClass(CustomClass value);
// 
//     @KeyByString("key_custom_class")
//     @RegisterChangeListenerMethod
//     @TypeAdapter(CustomClassTypeAdapter.class)
//     void registerCustomClassChangeListener(
//             OnPreferenceValueChangedListener<CustomClass> listener);
// 
//     @KeyByString("key_custom_class")
//     @UnregisterChangeListenerMethod
//     @TypeAdapter(CustomClassTypeAdapter.class)
//     void unregisterCustomClassChangeListener(
//             OnPreferenceValueChangedListener<CustomClass> listener);
// }
// 
// Path: storebox-harness/src/main/java/net/orange_box/storebox/harness/types/CustomClass.java
// public class CustomClass {
//     
//     private int hashCode;
//     
//     private final String one;
//     private final String two;
//     
//     public CustomClass() {
//         this("", "");
//     }
//     
//     public CustomClass(String one, String two) {
//         this.one = one;
//         this.two = two;
//     }
//     
//     public String getOne() {
//         return one;
//     }
//     
//     public String getTwo() {
//         return two;
//     }
// 
//     @Override
//     public boolean equals(Object o) {
//         if (o == null || !(o instanceof CustomClass)) {
//             return false;
//         }
//         
//         final CustomClass other = (CustomClass) o;
//         return (one.equals(other.one) && two.equals(other.two));
//     }
// 
//     @Override
//     public int hashCode() {
//         if (hashCode == 0) {
//             hashCode = Arrays.hashCode(new String[] {one, two});
//         }
//         
//         return hashCode;
//     }
// }
// 
// Path: storebox-lib/src/main/java/net/orange_box/storebox/listeners/OnPreferenceValueChangedListener.java
// public interface OnPreferenceValueChangedListener<T> {
//     
//     void onChanged(T newValue);
// }


// Path: storebox-harness/src/androidTest/java/net/orange_box/storebox/harness/changes/ChangesListenersTestCase.java
import android.test.UiThreadTest;
import android.test.suitebuilder.annotation.SmallTest;
import net.orange_box.storebox.harness.base.PreferencesTestCase;
import net.orange_box.storebox.harness.interfaces.changes.ChangeListenersInterface;
import net.orange_box.storebox.harness.types.CustomClass;
import net.orange_box.storebox.listeners.OnPreferenceValueChangedListener;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;

/*
 * Copyright 2015 Martin Bella
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *     http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package net.orange_box.storebox.harness.changes;




public class ChangesListenersTestCase extends
        PreferencesTestCase<ChangeListenersInterface> {

    @Override
    protected Class<ChangeListenersInterface> getInterface() {
        return ChangeListenersInterface.class;
    }
    
    @UiThreadTest
    @SmallTest
    public void testIntChanged() {
        final AtomicInteger value = new AtomicInteger(-1);
        final OnPreferenceValueChangedListener<Integer> listener =