diff --git a/AndroidAnnotations/androidannotations-api/src/main/java/org/androidannotations/annotations/CustomTitle.java b/AndroidAnnotations/androidannotations-api/src/main/java/org/androidannotations/annotations/CustomTitle.java
index 7aa056ee12..64a8d36754 100644
--- a/AndroidAnnotations/androidannotations-api/src/main/java/org/androidannotations/annotations/CustomTitle.java
+++ b/AndroidAnnotations/androidannotations-api/src/main/java/org/androidannotations/annotations/CustomTitle.java
@@ -1,46 +1,46 @@
-/**
- * Copyright (C) 2010-2014 eBusiness Information, Excilys Group
- *
- * 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 org.androidannotations.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Use it on {@link EActivity} annotated classes to set a custom title layout.
- *
- * The annotation value is mandatory and should be one of R.layout.* fields.
- *
- *
- */
-@Retention(RetentionPolicy.CLASS)
-@Target(ElementType.TYPE)
-public @interface CustomTitle {
- int value();
-}
+/**
+ * Copyright (C) 2010-2014 eBusiness Information, Excilys Group
+ *
+ * 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 org.androidannotations.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Use it on {@link EActivity} annotated classes to set a custom title layout.
+ *
+ * The annotation value is mandatory and should be one of R.layout.* fields.
+ *
+ *
+ */
+@Retention(RetentionPolicy.CLASS)
+@Target(ElementType.TYPE)
+public @interface CustomTitle {
+ int value();
+}
diff --git a/AndroidAnnotations/functional-test-1-5-tests/.settings/org.eclipse.core.resources.prefs b/AndroidAnnotations/functional-test-1-5-tests/.settings/org.eclipse.core.resources.prefs
index d43e3246f9..f02244085c 100644
--- a/AndroidAnnotations/functional-test-1-5-tests/.settings/org.eclipse.core.resources.prefs
+++ b/AndroidAnnotations/functional-test-1-5-tests/.settings/org.eclipse.core.resources.prefs
@@ -1,4 +1,4 @@
-#Thu Jan 19 14:10:02 CET 2012
eclipse.preferences.version=1
encoding//src/test/java=UTF-8
+encoding//src/test/resources=UTF-8
encoding/=UTF-8
diff --git a/AndroidAnnotations/functional-test-1-5-tests/pom.xml b/AndroidAnnotations/functional-test-1-5-tests/pom.xml
index 273601d616..428648d5a2 100644
--- a/AndroidAnnotations/functional-test-1-5-tests/pom.xml
+++ b/AndroidAnnotations/functional-test-1-5-tests/pom.xml
@@ -24,10 +24,23 @@
test
- com.pivotallabs
+ com.google.android
+ support-v4
+ r7
+ test
+
+
+ org.robolectricrobolectric
- 1.1
+ 2.3test
+
+
+
+ com.android.support
+ support-v4
+
+ org.easytesting
diff --git a/AndroidAnnotations/functional-test-1-5-tests/src/test/java/com/xtremelabs/robolectric/shadows/CustomShadowBundle.java b/AndroidAnnotations/functional-test-1-5-tests/src/test/java/com/xtremelabs/robolectric/shadows/CustomShadowBundle.java
deleted file mode 100644
index dc02ce80f5..0000000000
--- a/AndroidAnnotations/functional-test-1-5-tests/src/test/java/com/xtremelabs/robolectric/shadows/CustomShadowBundle.java
+++ /dev/null
@@ -1,628 +0,0 @@
-/**
- * Copyright (C) 2010-2014 eBusiness Information, Excilys Group
- *
- * 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 com.xtremelabs.robolectric.shadows;
-
-import static com.xtremelabs.robolectric.Robolectric.shadowOf_;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-import android.os.Bundle;
-import android.os.Parcelable;
-import android.util.SparseArray;
-
-import com.xtremelabs.robolectric.internal.Implementation;
-import com.xtremelabs.robolectric.internal.Implements;
-
-@SuppressWarnings("unchecked")
-@Implements(Bundle.class)
-public class CustomShadowBundle {
-
- Map mMap;
-
- public CustomShadowBundle() {
- mMap = new HashMap();
- }
-
- @Implementation
- public boolean isEmpty() {
- return mMap.isEmpty();
- }
-
- @Implementation
- public void clear() {
- mMap.clear();
- }
-
- @Implementation
- public boolean containsKey(String key) {
- return mMap.containsKey(key);
- }
-
- @Implementation
- public Object get(String key) {
- return mMap.get(key);
- }
-
- @Implementation
- public void remove(String key) {
- mMap.remove(key);
- }
-
- @Implementation
- public Set keySet() {
- return mMap.keySet();
- }
-
- @Implementation
- public void putBoolean(String key, boolean value) {
- mMap.put(key, value);
- }
-
- @Implementation
- public void putByte(String key, byte value) {
- mMap.put(key, value);
- }
-
- @Implementation
- public void putChar(String key, char value) {
- mMap.put(key, value);
- }
-
- @Implementation
- public void putShort(String key, short value) {
- mMap.put(key, value);
- }
-
- @Implementation
- public void putInt(String key, int value) {
- mMap.put(key, value);
- }
-
- @Implementation
- public void putLong(String key, long value) {
- mMap.put(key, value);
- }
-
- @Implementation
- public void putFloat(String key, float value) {
- mMap.put(key, value);
- }
-
- @Implementation
- public void putDouble(String key, double value) {
- mMap.put(key, value);
- }
-
- @Implementation
- public void putString(String key, String value) {
- mMap.put(key, value);
- }
-
- @Implementation
- public void putCharSequence(String key, CharSequence value) {
- mMap.put(key, value);
- }
-
- @Implementation
- public void putParcelable(String key, Parcelable value) {
- mMap.put(key, value);
- }
-
- @Implementation
- public void putParcelableArray(String key, Parcelable[] value) {
- mMap.put(key, value);
- }
-
- @Implementation
- public void putParcelableArrayList(String key,
- ArrayList extends Parcelable> value) {
- mMap.put(key, value);
- }
-
- @Implementation
- public void putSparseParcelableArray(String key,
- SparseArray extends Parcelable> value) {
- mMap.put(key, value);
- }
-
- @Implementation
- public void putIntegerArrayList(String key, ArrayList value) {
- mMap.put(key, value);
- }
-
- @Implementation
- public void putStringArrayList(String key, ArrayList value) {
- mMap.put(key, value);
- }
-
- @Implementation
- public void putSerializable(String key, Serializable value) {
- mMap.put(key, value);
- }
-
- @Implementation
- public void putBooleanArray(String key, boolean[] value) {
- mMap.put(key, value);
- }
-
- @Implementation
- public void putByteArray(String key, byte[] value) {
- mMap.put(key, value);
- }
-
- @Implementation
- public void putShortArray(String key, short[] value) {
- mMap.put(key, value);
- }
-
- @Implementation
- public void putCharArray(String key, char[] value) {
- mMap.put(key, value);
- }
-
- @Implementation
- public void putIntArray(String key, int[] value) {
- mMap.put(key, value);
- }
-
- @Implementation
- public void putLongArray(String key, long[] value) {
- mMap.put(key, value);
- }
-
- @Implementation
- public void putFloatArray(String key, float[] value) {
- mMap.put(key, value);
- }
-
- @Implementation
- public void putDoubleArray(String key, double[] value) {
- mMap.put(key, value);
- }
-
- @Implementation
- public void putStringArray(String key, String[] value) {
- mMap.put(key, value);
- }
-
- @Implementation
- public void putBundle(String key, Bundle value) {
- mMap.put(key, value);
- }
-
- @Implementation
- public boolean getBoolean(String key) {
- return getBoolean(key, false);
- }
-
- @Implementation
- public boolean getBoolean(String key, boolean defaultValue) {
- Object o = mMap.get(key);
- if (o == null) {
- return defaultValue;
- }
- try {
- return (Boolean) o;
- } catch (ClassCastException e) {
- return defaultValue;
- }
- }
-
- @Implementation
- public byte getByte(String key) {
- return getByte(key, (byte) 0);
- }
-
- @Implementation
- public Byte getByte(String key, byte defaultValue) {
- Object o = mMap.get(key);
- if (o == null) {
- return defaultValue;
- }
- try {
- return (Byte) o;
- } catch (ClassCastException e) {
- return defaultValue;
- }
- }
-
- @Implementation
- public char getChar(String key) {
- return getChar(key, (char) 0);
- }
-
- @Implementation
- public char getChar(String key, char defaultValue) {
- Object o = mMap.get(key);
- if (o == null) {
- return defaultValue;
- }
- try {
- return (Character) o;
- } catch (ClassCastException e) {
- return defaultValue;
- }
- }
-
- @Implementation
- public short getShort(String key) {
- return getShort(key, (short) 0);
- }
-
- @Implementation
- public short getShort(String key, short defaultValue) {
- Object o = mMap.get(key);
- if (o == null) {
- return defaultValue;
- }
- try {
- return (Short) o;
- } catch (ClassCastException e) {
- return defaultValue;
- }
- }
-
- @Implementation
- public int getInt(String key) {
- return getInt(key, 0);
- }
-
- @Implementation
- public int getInt(String key, int defaultValue) {
- Object o = mMap.get(key);
- if (o == null) {
- return defaultValue;
- }
- try {
- return (Integer) o;
- } catch (ClassCastException e) {
- return defaultValue;
- }
- }
-
- @Implementation
- public long getLong(String key) {
- return getLong(key, 0L);
- }
-
- @Implementation
- public long getLong(String key, long defaultValue) {
- Object o = mMap.get(key);
- if (o == null) {
- return defaultValue;
- }
- try {
- return (Long) o;
- } catch (ClassCastException e) {
- return defaultValue;
- }
- }
-
- @Implementation
- public float getFloat(String key) {
- return getFloat(key, 0.0f);
- }
-
- @Implementation
- public float getFloat(String key, float defaultValue) {
- Object o = mMap.get(key);
- if (o == null) {
- return defaultValue;
- }
- try {
- return (Float) o;
- } catch (ClassCastException e) {
- return defaultValue;
- }
- }
-
- @Implementation
- public double getDouble(String key) {
- return getDouble(key, 0.0);
- }
-
- @Implementation
- public double getDouble(String key, double defaultValue) {
- Object o = mMap.get(key);
- if (o == null) {
- return defaultValue;
- }
- try {
- return (Double) o;
- } catch (ClassCastException e) {
- return defaultValue;
- }
- }
-
- @Implementation
- public String getString(String key) {
- Object o = mMap.get(key);
- if (o == null) {
- return null;
- }
- try {
- return (String) o;
- } catch (ClassCastException e) {
- return null;
- }
- }
-
- @Implementation
- public CharSequence getCharSequence(String key) {
- Object o = mMap.get(key);
- if (o == null) {
- return null;
- }
- try {
- return (CharSequence) o;
- } catch (ClassCastException e) {
- return null;
- }
- }
-
- @Implementation
- public Bundle getBundle(String key) {
- Object o = mMap.get(key);
- if (o == null) {
- return null;
- }
- try {
- return (Bundle) o;
- } catch (ClassCastException e) {
- return null;
- }
- }
-
- @Implementation
- public T getParcelable(String key) {
- Object o = mMap.get(key);
- if (o == null) {
- return null;
- }
- try {
- return (T) o;
- } catch (ClassCastException e) {
- return null;
- }
- }
-
- @Implementation
- public Parcelable[] getParcelableArray(String key) {
- Object o = mMap.get(key);
- if (o == null) {
- return null;
- }
- try {
- return (Parcelable[]) o;
- } catch (ClassCastException e) {
- return null;
- }
- }
-
- @Implementation
- public ArrayList getParcelableArrayList(String key) {
- Object o = mMap.get(key);
- if (o == null) {
- return null;
- }
- try {
- return (ArrayList) o;
- } catch (ClassCastException e) {
- return null;
- }
- }
-
- @Implementation
- public SparseArray getSparseParcelableArray(
- String key) {
- Object o = mMap.get(key);
- if (o == null) {
- return null;
- }
- try {
- return (SparseArray) o;
- } catch (ClassCastException e) {
- return null;
- }
- }
-
- @Implementation
- public Serializable getSerializable(String key) {
- Object o = mMap.get(key);
- if (o == null) {
- return null;
- }
- try {
- return (Serializable) o;
- } catch (ClassCastException e) {
- return null;
- }
- }
-
- @Implementation
- public ArrayList getIntegerArrayList(String key) {
- Object o = mMap.get(key);
- if (o == null) {
- return null;
- }
- try {
- return (ArrayList) o;
- } catch (ClassCastException e) {
- return null;
- }
- }
-
- @Implementation
- public ArrayList getStringArrayList(String key) {
- Object o = mMap.get(key);
- if (o == null) {
- return null;
- }
- try {
- return (ArrayList) o;
- } catch (ClassCastException e) {
- return null;
- }
- }
-
- @Implementation
- public boolean[] getBooleanArray(String key) {
- Object o = mMap.get(key);
- if (o == null) {
- return null;
- }
- try {
- return (boolean[]) o;
- } catch (ClassCastException e) {
- return null;
- }
- }
-
- @Implementation
- public byte[] getByteArray(String key) {
- Object o = mMap.get(key);
- if (o == null) {
- return null;
- }
- try {
- return (byte[]) o;
- } catch (ClassCastException e) {
- return null;
- }
- }
-
- @Implementation
- public short[] getShortArray(String key) {
- Object o = mMap.get(key);
- if (o == null) {
- return null;
- }
- try {
- return (short[]) o;
- } catch (ClassCastException e) {
- return null;
- }
- }
-
- @Implementation
- public char[] getCharArray(String key) {
- Object o = mMap.get(key);
- if (o == null) {
- return null;
- }
- try {
- return (char[]) o;
- } catch (ClassCastException e) {
- return null;
- }
- }
-
- @Implementation
- public int[] getIntArray(String key) {
- Object o = mMap.get(key);
- if (o == null) {
- return null;
- }
- try {
- return (int[]) o;
- } catch (ClassCastException e) {
- return null;
- }
- }
-
- @Implementation
- public long[] getLongArray(String key) {
- Object o = mMap.get(key);
- if (o == null) {
- return null;
- }
- try {
- return (long[]) o;
- } catch (ClassCastException e) {
- return null;
- }
- }
-
- @Implementation
- public float[] getFloatArray(String key) {
- Object o = mMap.get(key);
- if (o == null) {
- return null;
- }
- try {
- return (float[]) o;
- } catch (ClassCastException e) {
- return null;
- }
- }
-
- @Implementation
- public double[] getDoubleArray(String key) {
- Object o = mMap.get(key);
- if (o == null) {
- return null;
- }
- try {
- return (double[]) o;
- } catch (ClassCastException e) {
- return null;
- }
- }
-
- @Implementation
- public String[] getStringArray(String key) {
- Object o = mMap.get(key);
- if (o == null) {
- return null;
- }
- try {
- return (String[]) o;
- } catch (ClassCastException e) {
- return null;
- }
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((mMap == null) ? 0 : mMap.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- obj = shadowOf_(obj);
- if (getClass() != obj.getClass())
- return false;
- CustomShadowBundle other = (CustomShadowBundle) obj;
- if (mMap == null) {
- if (other.mMap != null)
- return false;
- } else if (!mMap.equals(other.mMap))
- return false;
- return true;
- }
-
-}
diff --git a/AndroidAnnotations/functional-test-1-5-tests/src/test/java/com/xtremelabs/robolectric/shadows/ShadowButton.java b/AndroidAnnotations/functional-test-1-5-tests/src/test/java/com/xtremelabs/robolectric/shadows/ShadowButton.java
deleted file mode 100644
index 252cf35fc8..0000000000
--- a/AndroidAnnotations/functional-test-1-5-tests/src/test/java/com/xtremelabs/robolectric/shadows/ShadowButton.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * Copyright (C) 2010-2014 eBusiness Information, Excilys Group
- *
- * 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 com.xtremelabs.robolectric.shadows;
-
-import android.view.View;
-import android.widget.Button;
-
-import com.xtremelabs.robolectric.internal.Implementation;
-import com.xtremelabs.robolectric.internal.Implements;
-
-@Implements(Button.class)
-public class ShadowButton extends ShadowTextView {
-
- private View.OnLongClickListener onLongClickListener;
-
- @Implementation
- public boolean performLongClick() {
- if (onLongClickListener != null) {
- onLongClickListener.onLongClick(realView);
- return true;
- }
- return false;
- }
-
- @Implementation
- public void setOnLongClickListener(
- View.OnLongClickListener onLongClickListener) {
- this.onLongClickListener = onLongClickListener;
- }
-
-}
diff --git a/AndroidAnnotations/functional-test-1-5-tests/src/test/java/com/xtremelabs/robolectric/shadows/ShadowHtml.java b/AndroidAnnotations/functional-test-1-5-tests/src/test/java/com/xtremelabs/robolectric/shadows/ShadowHtml.java
deleted file mode 100644
index b7958cb599..0000000000
--- a/AndroidAnnotations/functional-test-1-5-tests/src/test/java/com/xtremelabs/robolectric/shadows/ShadowHtml.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/**
- * Copyright (C) 2010-2014 eBusiness Information, Excilys Group
- *
- * 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 com.xtremelabs.robolectric.shadows;
-
-import android.text.Html;
-import android.text.Spanned;
-
-import com.xtremelabs.robolectric.internal.Implementation;
-import com.xtremelabs.robolectric.internal.Implements;
-
-@Implements(Html.class)
-public class ShadowHtml {
- @Implementation
- public static Spanned fromHtml(String source) {
- return new SpannedThatActsLikeString(source);
- }
-
- private static class SpannedThatActsLikeString implements Spanned {
- String source;
-
- private SpannedThatActsLikeString(String source) {
- this.source = source;
- }
-
- @Override
- public T[] getSpans(int start, int end, Class type) {
- return null;
- }
-
- @Override
- public int getSpanStart(Object tag) {
- return 0;
- }
-
- @Override
- public int getSpanEnd(Object tag) {
- return 0;
- }
-
- @Override
- public int getSpanFlags(Object tag) {
- return 0;
- }
-
- @SuppressWarnings("rawtypes")
- @Override
- public int nextSpanTransition(int start, int limit, Class type) {
- return 0;
- }
-
- @Override
- public int length() {
- return 0;
- }
-
- @Override
- public char charAt(int i) {
- return 0;
- }
-
- @Override
- public CharSequence subSequence(int i, int i1) {
- return null;
- }
-
- @Override
- public String toString() {
- return source;
- }
-
- @Override
- public boolean equals(Object o) {
- if (o instanceof SpannedThatActsLikeString)
- return source.equals(((SpannedThatActsLikeString) o).source);
- else
- return source.equals(o);
- }
-
- @Override
- public int hashCode() {
- return source != null ? source.hashCode() : 0;
- }
- }
-}
diff --git a/AndroidAnnotations/functional-test-1-5-tests/src/test/java/com/xtremelabs/robolectric/shadows/ShadowListFragment.java b/AndroidAnnotations/functional-test-1-5-tests/src/test/java/com/xtremelabs/robolectric/shadows/ShadowListFragment.java
deleted file mode 100644
index aff19721c9..0000000000
--- a/AndroidAnnotations/functional-test-1-5-tests/src/test/java/com/xtremelabs/robolectric/shadows/ShadowListFragment.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * Copyright (C) 2010-2014 eBusiness Information, Excilys Group
- *
- * 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 com.xtremelabs.robolectric.shadows;
-
-import android.os.Bundle;
-import android.support.v4.app.ListFragment;
-import android.view.View;
-import android.widget.AdapterView;
-import android.widget.ListView;
-
-import com.xtremelabs.robolectric.internal.Implementation;
-import com.xtremelabs.robolectric.internal.Implements;
-
-@Implements(ListFragment.class)
-public class ShadowListFragment extends ShadowFragment {
-
- final private AdapterView.OnItemClickListener mOnClickListener = //
- new AdapterView.OnItemClickListener() {
- public void onItemClick(AdapterView> parent, View v, int position,
- long id) {
- onListItemClick((ListView) parent, v, position, id);
- }
- };
-
- @Implementation
- public void onViewCreated(View view, Bundle savedInstanceState) {
- ListView list = (ListView) view.findViewById(android.R.id.list);
- list.setOnItemClickListener(mOnClickListener);
- }
-
- @Implementation
- public void onListItemClick(ListView l, View v, int position, long id) {
- }
-}
diff --git a/AndroidAnnotations/functional-test-1-5-tests/src/test/java/org/androidannotations/test15/AbstractActivityTest.java b/AndroidAnnotations/functional-test-1-5-tests/src/test/java/org/androidannotations/test15/AbstractActivityTest.java
index 7beedd1a58..b2b58dbfd5 100644
--- a/AndroidAnnotations/functional-test-1-5-tests/src/test/java/org/androidannotations/test15/AbstractActivityTest.java
+++ b/AndroidAnnotations/functional-test-1-5-tests/src/test/java/org/androidannotations/test15/AbstractActivityTest.java
@@ -21,8 +21,9 @@
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.robolectric.RobolectricTestRunner;
-@RunWith(AndroidAnnotationsTestRunner.class)
+@RunWith(RobolectricTestRunner.class)
public class AbstractActivityTest {
@Test
diff --git a/AndroidAnnotations/functional-test-1-5-tests/src/test/java/org/androidannotations/test15/AndroidAnnotationsTestRunner.java b/AndroidAnnotations/functional-test-1-5-tests/src/test/java/org/androidannotations/test15/AndroidAnnotationsTestRunner.java
deleted file mode 100644
index f837e20222..0000000000
--- a/AndroidAnnotations/functional-test-1-5-tests/src/test/java/org/androidannotations/test15/AndroidAnnotationsTestRunner.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/**
- * Copyright (C) 2010-2014 eBusiness Information, Excilys Group
- *
- * 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 org.androidannotations.test15;
-
-import java.io.File;
-
-import org.junit.runners.model.InitializationError;
-
-import com.xtremelabs.robolectric.RobolectricTestRunner;
-
-public class AndroidAnnotationsTestRunner extends RobolectricTestRunner {
- public AndroidAnnotationsTestRunner(Class> testClass)
- throws InitializationError {
- super(testClass, new File("../functional-test-1-5"));
- }
-}
diff --git a/AndroidAnnotations/functional-test-1-5-tests/src/test/java/org/androidannotations/test15/ApplicationInjectedActivityTest.java b/AndroidAnnotations/functional-test-1-5-tests/src/test/java/org/androidannotations/test15/ApplicationInjectedActivityTest.java
index 5193a53e57..f57a13e5ea 100644
--- a/AndroidAnnotations/functional-test-1-5-tests/src/test/java/org/androidannotations/test15/ApplicationInjectedActivityTest.java
+++ b/AndroidAnnotations/functional-test-1-5-tests/src/test/java/org/androidannotations/test15/ApplicationInjectedActivityTest.java
@@ -21,16 +21,18 @@
import org.androidannotations.test15.roboguice.SampleRoboApplication_;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.robolectric.Robolectric;
+import org.robolectric.RobolectricTestRunner;
-@RunWith(AndroidAnnotationsTestRunner.class)
+@RunWith(RobolectricTestRunner.class)
public class ApplicationInjectedActivityTest {
-
+
@Test
public void should_have_application_after_create() {
- new SampleRoboApplication_().onCreate();
- ApplicationInjectedActivity_ activity = new ApplicationInjectedActivity_();
-
- activity.onCreate(null);
+ SampleRoboApplication_ application = new SampleRoboApplication_();
+ application.onCreate();
+
+ ApplicationInjectedActivity_ activity = Robolectric.buildActivity(ApplicationInjectedActivity_.class).create().get();
assertThat(activity.customApplication).isNotNull();
}
@@ -41,9 +43,7 @@ public void application_can_be_replaced_for_tests() {
SampleRoboApplication_.setForTesting(testApp);
- ApplicationInjectedActivity_ activity = new ApplicationInjectedActivity_();
-
- activity.onCreate(null);
+ ApplicationInjectedActivity_ activity = Robolectric.buildActivity(ApplicationInjectedActivity_.class).create().get();;
assertThat(activity.customApplication).isSameAs(testApp);
}
diff --git a/AndroidAnnotations/functional-test-1-5-tests/src/test/java/org/androidannotations/test15/AwaitingResultActivityTest.java b/AndroidAnnotations/functional-test-1-5-tests/src/test/java/org/androidannotations/test15/AwaitingResultActivityTest.java
index e4fb6eb443..eec1b93dac 100644
--- a/AndroidAnnotations/functional-test-1-5-tests/src/test/java/org/androidannotations/test15/AwaitingResultActivityTest.java
+++ b/AndroidAnnotations/functional-test-1-5-tests/src/test/java/org/androidannotations/test15/AwaitingResultActivityTest.java
@@ -19,8 +19,9 @@
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.robolectric.RobolectricTestRunner;
-@RunWith(AndroidAnnotationsTestRunner.class)
+@RunWith(RobolectricTestRunner.class)
public class AwaitingResultActivityTest {
@Test
diff --git a/AndroidAnnotations/functional-test-1-5-tests/src/test/java/org/androidannotations/test15/ClicksHandledActivityTest.java b/AndroidAnnotations/functional-test-1-5-tests/src/test/java/org/androidannotations/test15/ClicksHandledActivityTest.java
index cbf21d8151..d57a0df647 100644
--- a/AndroidAnnotations/functional-test-1-5-tests/src/test/java/org/androidannotations/test15/ClicksHandledActivityTest.java
+++ b/AndroidAnnotations/functional-test-1-5-tests/src/test/java/org/androidannotations/test15/ClicksHandledActivityTest.java
@@ -21,21 +21,19 @@
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.robolectric.Robolectric;
+import org.robolectric.RobolectricTestRunner;
-import com.xtremelabs.robolectric.Robolectric;
-import com.xtremelabs.robolectric.shadows.ShadowButton;
-@RunWith(AndroidAnnotationsTestRunner.class)
+
+@RunWith(RobolectricTestRunner.class)
public class ClicksHandledActivityTest {
private ClicksHandledActivity_ activity;
@Before
public void setup() {
- Robolectric.bindShadowClass(ShadowButton.class);
-
- activity = new ClicksHandledActivity_();
- activity.onCreate(null);
+ activity = Robolectric.buildActivity(ClicksHandledActivity_.class).create().get();
}
@Test
diff --git a/AndroidAnnotations/functional-test-1-5-tests/src/test/java/org/androidannotations/test15/EmptyActivityWithLayoutTest.java b/AndroidAnnotations/functional-test-1-5-tests/src/test/java/org/androidannotations/test15/EmptyActivityWithLayoutTest.java
index 842510c64b..49752eff18 100644
--- a/AndroidAnnotations/functional-test-1-5-tests/src/test/java/org/androidannotations/test15/EmptyActivityWithLayoutTest.java
+++ b/AndroidAnnotations/functional-test-1-5-tests/src/test/java/org/androidannotations/test15/EmptyActivityWithLayoutTest.java
@@ -19,15 +19,16 @@
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.robolectric.Robolectric;
+import org.robolectric.RobolectricTestRunner;
-@RunWith(AndroidAnnotationsTestRunner.class)
+@RunWith(RobolectricTestRunner.class)
public class EmptyActivityWithLayoutTest {
@Test
public void shouldHaveLayoutAfterCreate() {
- EmptyActivityWithLayout_ activity = new EmptyActivityWithLayout_();
+ EmptyActivityWithLayout_ activity = Robolectric.buildActivity(EmptyActivityWithLayout_.class).create().get();
- activity.onCreate(null);
activity.setContentView(R.layout.main);
assertThat(activity.findViewById(R.id.helloTextView)).hasId(
diff --git a/AndroidAnnotations/functional-test-1-5-tests/src/test/java/org/androidannotations/test15/EmptyActivityWithoutLayoutTest.java b/AndroidAnnotations/functional-test-1-5-tests/src/test/java/org/androidannotations/test15/EmptyActivityWithoutLayoutTest.java
index 5767565b17..2aacdc4f72 100644
--- a/AndroidAnnotations/functional-test-1-5-tests/src/test/java/org/androidannotations/test15/EmptyActivityWithoutLayoutTest.java
+++ b/AndroidAnnotations/functional-test-1-5-tests/src/test/java/org/androidannotations/test15/EmptyActivityWithoutLayoutTest.java
@@ -19,17 +19,19 @@
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.robolectric.Robolectric;
+import org.robolectric.RobolectricTestRunner;
import android.view.View;
-@RunWith(AndroidAnnotationsTestRunner.class)
+@RunWith(RobolectricTestRunner.class)
public class EmptyActivityWithoutLayoutTest {
@Test
public void shouldHaveNoLayoutAfterCreate() {
- EmptyActivityWithoutLayout_ activity = new EmptyActivityWithoutLayout_();
-
- activity.onCreate(null);
+ EmptyActivityWithoutLayout_ activity = Robolectric
+ .buildActivity(EmptyActivityWithoutLayout_.class).create()
+ .get();
activity.setContentView(new View(activity));
assertThat(activity.findViewById(R.id.helloTextView)).isNull();
diff --git a/AndroidAnnotations/functional-test-1-5-tests/src/test/java/org/androidannotations/test15/FromHtmlActivityTest.java b/AndroidAnnotations/functional-test-1-5-tests/src/test/java/org/androidannotations/test15/FromHtmlActivityTest.java
index 53a2873ffe..0dd9930f22 100644
--- a/AndroidAnnotations/functional-test-1-5-tests/src/test/java/org/androidannotations/test15/FromHtmlActivityTest.java
+++ b/AndroidAnnotations/functional-test-1-5-tests/src/test/java/org/androidannotations/test15/FromHtmlActivityTest.java
@@ -21,23 +21,19 @@
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.robolectric.Robolectric;
+import org.robolectric.RobolectricTestRunner;
import android.text.Html;
-import com.xtremelabs.robolectric.Robolectric;
-import com.xtremelabs.robolectric.shadows.ShadowHtml;
-
-@RunWith(AndroidAnnotationsTestRunner.class)
+@RunWith(RobolectricTestRunner.class)
public class FromHtmlActivityTest {
private FromHtmlActivity_ activity;
@Before
public void setup() {
- Robolectric.bindShadowClass(ShadowHtml.class);
-
- activity = new FromHtmlActivity_();
- activity.onCreate(null);
+ activity = Robolectric.buildActivity(FromHtmlActivity_.class).create().get();
}
@Test
diff --git a/AndroidAnnotations/functional-test-1-5-tests/src/test/java/org/androidannotations/test15/InjectExtraTest.java b/AndroidAnnotations/functional-test-1-5-tests/src/test/java/org/androidannotations/test15/InjectExtraTest.java
index 8abedd14ab..6ae5589c5c 100644
--- a/AndroidAnnotations/functional-test-1-5-tests/src/test/java/org/androidannotations/test15/InjectExtraTest.java
+++ b/AndroidAnnotations/functional-test-1-5-tests/src/test/java/org/androidannotations/test15/InjectExtraTest.java
@@ -22,35 +22,40 @@
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.robolectric.Robolectric;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.util.ActivityController;
import android.app.Activity;
import android.content.Context;
-@RunWith(AndroidAnnotationsTestRunner.class)
+@RunWith(RobolectricTestRunner.class)
public class InjectExtraTest {
private ExtraInjectedActivity_ activity;
- private Context context = new Activity();
+ private Context context = Robolectric.buildActivity(Activity.class).create().get();
+ private ActivityController controller;
@Before
public void setup() {
- activity = new ExtraInjectedActivity_();
+ controller = ActivityController.of(ExtraInjectedActivity_.class);
+ activity = controller.get();
}
@Test
public void simple_string_extra_injected() {
- activity.setIntent(ExtraInjectedActivity_.intent(context)
- .stringExtra("Hello!").get());
- activity.onCreate(null);
+ controller.withIntent(ExtraInjectedActivity_.intent(context)
+ .stringExtra("Hello!").get())
+ .create();
assertThat(activity.stringExtra).isEqualTo("Hello!");
}
@Test
public void array_extra_injected() {
CustomData[] customData = { new CustomData("42") };
- activity.setIntent(ExtraInjectedActivity_.intent(context)
- .arrayExtra(customData).get());
- activity.onCreate(null);
+ controller.withIntent(ExtraInjectedActivity_.intent(context)
+ .arrayExtra(customData).get())
+ .create();
assertThat(activity.arrayExtra).isEqualTo(customData);
}
@@ -58,36 +63,36 @@ public void array_extra_injected() {
public void list_extra_injected() {
ArrayList list = new ArrayList();
list.add("Hello !");
- activity.setIntent(ExtraInjectedActivity_.intent(context)
- .listExtra(list).get());
- activity.onCreate(null);
+ controller.withIntent(ExtraInjectedActivity_.intent(context)
+ .listExtra(list).get())
+ .create();
assertThat(activity.listExtra).isEqualTo(list);
}
@Test
public void int_extra_injected() {
- activity.setIntent(ExtraInjectedActivity_.intent(context).intExtra(42)
- .get());
- activity.onCreate(null);
+ controller.withIntent(ExtraInjectedActivity_.intent(context).intExtra(42)
+ .get())
+ .create();
assertThat(activity.intExtra).isEqualTo(42);
}
@Test
public void int_array_extra_injected() {
byte[] byteArray = { 0, 2 };
- activity.setIntent(ExtraInjectedActivity_.intent(context)
- .byteArrayExtra(byteArray).get());
- activity.onCreate(null);
+ controller.withIntent(ExtraInjectedActivity_.intent(context)
+ .byteArrayExtra(byteArray).get())
+ .create();
assertThat(activity.byteArrayExtra).isEqualTo(byteArray);
}
@Test
public void setIntent_reinjects_extra() {
- activity.setIntent(ExtraInjectedActivity_.intent(context)
- .stringExtra("Hello!").get());
- activity.onCreate(null);
+ controller.withIntent(ExtraInjectedActivity_.intent(context)
+ .stringExtra("Hello!").get())
+ .create();
- activity.setIntent(ExtraInjectedActivity_.intent(context)
+ controller.newIntent(ExtraInjectedActivity_.intent(context)
.stringExtra("Hello Again!").get());
assertThat(activity.stringExtra).isEqualTo("Hello Again!");
@@ -95,9 +100,9 @@ public void setIntent_reinjects_extra() {
@Test
public void extraWithoutValueInjected() {
- activity.setIntent(ExtraInjectedActivity_.intent(context)
- .extraWithoutValue("Hello!").get());
- activity.onCreate(null);
+ controller.withIntent(ExtraInjectedActivity_.intent(context)
+ .extraWithoutValue("Hello!").get())
+ .create();
assertThat(activity.extraWithoutValue).isEqualTo("Hello!");
}
diff --git a/AndroidAnnotations/functional-test-1-5-tests/src/test/java/org/androidannotations/test15/ItemClicksHandledActivityTest.java b/AndroidAnnotations/functional-test-1-5-tests/src/test/java/org/androidannotations/test15/ItemClicksHandledActivityTest.java
index 1c077d56a9..49b1c0a5bd 100644
--- a/AndroidAnnotations/functional-test-1-5-tests/src/test/java/org/androidannotations/test15/ItemClicksHandledActivityTest.java
+++ b/AndroidAnnotations/functional-test-1-5-tests/src/test/java/org/androidannotations/test15/ItemClicksHandledActivityTest.java
@@ -15,16 +15,19 @@
*/
package org.androidannotations.test15;
-import android.view.View;
-import android.widget.ListView;
-import android.widget.Spinner;
+import static org.fest.assertions.Assertions.assertThat;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.robolectric.Robolectric;
+import org.robolectric.RobolectricTestRunner;
-import static org.fest.assertions.Assertions.assertThat;
+import android.view.View;
+import android.widget.ListView;
+import android.widget.Spinner;
-@RunWith(AndroidAnnotationsTestRunner.class)
+@RunWith(RobolectricTestRunner.class)
public class ItemClicksHandledActivityTest {
private static final int TESTED_CLICKED_INDEX = 3;
@@ -35,20 +38,17 @@ public class ItemClicksHandledActivityTest {
@Before
public void setup() {
- activity = new ItemClicksHandledActivity_();
- activity.onCreate(null);
+ activity = Robolectric.buildActivity(ItemClicksHandledActivity_.class).create().get();
clickedItem = activity.getResources().getStringArray(
R.array.planets_array)[TESTED_CLICKED_INDEX];
}
@Test
- public void handlingSpinnerItemClick() {
+ public void handlingSpinnerItemSelect() {
Spinner spinner = (Spinner) activity.findViewById(R.id.spinner);
- long itemId = spinner.getAdapter().getItemId(TESTED_CLICKED_INDEX);
- View view = spinner.getChildAt(0);
-
assertThat(activity.spinnerItemClicked).isFalse();
- spinner.performItemClick(view, TESTED_CLICKED_INDEX, itemId);
+
+ spinner.getOnItemSelectedListener().onItemSelected(spinner, null, TESTED_CLICKED_INDEX, 0);
assertThat(activity.spinnerItemClicked).isTrue();
}
@@ -64,14 +64,12 @@ public void handlingListViewItemClick() {
}
@Test
- public void handlingSpinnerItemClickWithArgument() {
+ public void handlingSpinnerItemSelectWithArgument() {
Spinner spinner = (Spinner) activity
.findViewById(R.id.spinnerWithArgument);
- long itemId = spinner.getAdapter().getItemId(TESTED_CLICKED_INDEX);
- View view = spinner.getChildAt(TESTED_CLICKED_INDEX);
assertThat(activity.spinnerWithArgumentSelectedItem).isNull();
- spinner.performItemClick(view, TESTED_CLICKED_INDEX, itemId);
+ spinner.getOnItemSelectedListener().onItemSelected(spinner, null, TESTED_CLICKED_INDEX, 0);
assertThat(activity.spinnerWithArgumentSelectedItem).isNotNull();
assertThat(activity.spinnerWithArgumentSelectedItem).isEqualTo(
clickedItem);
@@ -106,13 +104,13 @@ public void handlingListViewItemClickWithPosition() {
@Test
public void handlingListViewWithPositionItemSelected() {
- ListView listView = (ListView) activity
+ final ListView listView = (ListView) activity
.findViewById(R.id.listViewWithPosition);
assertThat(activity.listViewWithPositionItemSelectedPosition)
.isEqualTo(0);
assertThat(activity.listViewWithPositionItemSelected).isFalse();
- listView.setSelection(TESTED_CLICKED_INDEX);
+ listView.getOnItemSelectedListener().onItemSelected(listView, null, TESTED_CLICKED_INDEX, 0);
assertThat(activity.listViewWithPositionItemSelected).isTrue();
assertThat(activity.listViewWithPositionItemSelectedPosition)
.isEqualTo(TESTED_CLICKED_INDEX);
@@ -123,7 +121,7 @@ public void can_have_one_selected_argument() {
ListView listView = (ListView) activity
.findViewById(R.id.listViewWithOneParam);
assertThat(activity.listViewWithOneParamItemSelected).isFalse();
- listView.setSelection(TESTED_CLICKED_INDEX);
+ listView.getOnItemSelectedListener().onItemSelected(listView, null, TESTED_CLICKED_INDEX, 0);
assertThat(activity.listViewWithOneParamItemSelected).isTrue();
}
diff --git a/AndroidAnnotations/functional-test-1-5-tests/src/test/java/org/androidannotations/test15/LongClicksHandledActivityTest.java b/AndroidAnnotations/functional-test-1-5-tests/src/test/java/org/androidannotations/test15/LongClicksHandledActivityTest.java
index 08e0fb6efb..94549d38be 100644
--- a/AndroidAnnotations/functional-test-1-5-tests/src/test/java/org/androidannotations/test15/LongClicksHandledActivityTest.java
+++ b/AndroidAnnotations/functional-test-1-5-tests/src/test/java/org/androidannotations/test15/LongClicksHandledActivityTest.java
@@ -21,21 +21,17 @@
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.robolectric.Robolectric;
+import org.robolectric.RobolectricTestRunner;
-import com.xtremelabs.robolectric.Robolectric;
-import com.xtremelabs.robolectric.shadows.ShadowButton;
-
-@RunWith(AndroidAnnotationsTestRunner.class)
+@RunWith(RobolectricTestRunner.class)
public class LongClicksHandledActivityTest {
private LongClicksHandledActivity_ activity;
@Before
public void setup() {
- Robolectric.bindShadowClass(ShadowButton.class);
-
- activity = new LongClicksHandledActivity_();
- activity.onCreate(null);
+ activity = Robolectric.buildActivity(LongClicksHandledActivity_.class).create().get();
}
@Test
diff --git a/AndroidAnnotations/functional-test-1-5-tests/src/test/java/org/androidannotations/test15/RobolectricParameterized.java b/AndroidAnnotations/functional-test-1-5-tests/src/test/java/org/androidannotations/test15/RobolectricParameterized.java
deleted file mode 100644
index 6a60ba6d08..0000000000
--- a/AndroidAnnotations/functional-test-1-5-tests/src/test/java/org/androidannotations/test15/RobolectricParameterized.java
+++ /dev/null
@@ -1,256 +0,0 @@
-/**
- * Copyright (C) 2010-2014 eBusiness Information, Excilys Group
- *
- * 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 org.androidannotations.test15;
-
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.junit.runner.Runner;
-import org.junit.runner.notification.RunNotifier;
-import org.junit.runners.BlockJUnit4ClassRunner;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
-import org.junit.runners.Suite;
-import org.junit.runners.model.FrameworkMethod;
-import org.junit.runners.model.InitializationError;
-import org.junit.runners.model.Statement;
-import org.junit.runners.model.TestClass;
-
-import com.xtremelabs.robolectric.RobolectricTestRunner;
-import com.xtremelabs.robolectric.bytecode.RobolectricClassLoader;
-
-/**
- * This class is a copy of Junit {@link Parameterized}, but it creates
- * {@link AndroidAnnotationsTestRunner} runners instead of
- * {@link BlockJUnit4ClassRunner}
- *
- * We added some hacks, because Robolectric has a lot of expectations on how the
- * runner and the tested class should work.
- *
- *
- *
- * The custom runner Parameterized implements parameterized tests.
- * When running a parameterized test class, instances are created for the
- * cross-product of the test methods and the test data elements.
- *
- *
- *
- * The test must have a constructor with no parameters. The parameters are
- * passed through an init() method, which can have any number of parameters. The
- * parameters of the init() method must match the {@link Parameterized} test
- * data.
- *
- *
- * For example, to test a Fibonacci function, write:
- *
- *
- * Each instance of FibonacciTest will be constructed using the
- * two-argument constructor and the data values in the
- * @Parameters method.
- *
- */
-public class RobolectricParameterized extends Suite {
-
- public static class TestClassRunnerForParameters extends
- AndroidAnnotationsTestRunner {
- private int parameterSetNumber;
-
- private List