IntentBuilder { public IntentBuilder extra(String name, boolean value) { validateNotBlank(name, "Name"); mIntent.putExtra(name, value); return this; } IntentBuilder();  IntentBuilder(Intent intent);  IntentBuilder(String action);  IntentBuilder(String action, Uri uri);  IntentBuilder(Context packageContext, Class<?> cls);  IntentBuilder(String action, Uri uri, Context packageContext, Class<?> cls); IntentBuilder context(Context context); IntentBuilder action(String action); IntentBuilder service(Class<? extends Service> service); IntentBuilder activity(Class<? extends Activity> activity); IntentBuilder receiver(Class<? extends BroadcastReceiver> receiver); IntentBuilder component(ComponentName component); IntentBuilder className(Context packageCtx, String className); IntentBuilder className(String packageName, String className); IntentBuilder setPackage(String pack); IntentBuilder flag(int flag); IntentBuilder flags(int... flags); IntentBuilder categories(String... categories); IntentBuilder extras(Bundle extras); IntentBuilder extras(Intent intent); IntentBuilder data(Uri data); @TargetApi(Build.VERSION_CODES.JELLY_BEAN) IntentBuilder dataNormalize(Uri data); IntentBuilder type(String type); @TargetApi(Build.VERSION_CODES.JELLY_BEAN) IntentBuilder typeNormalize(String type); IntentBuilder extra(String name, boolean value); IntentBuilder extra(String name, byte value); IntentBuilder extra(String name, char value); IntentBuilder extra(String name, double value); IntentBuilder extra(String name, float value); IntentBuilder extra(String name, int value); IntentBuilder extra(String name, long value); IntentBuilder extra(String name, short value); IntentBuilder extra(String name, String value); IntentBuilder extra(String name, byte[] value); IntentBuilder extra(String name, boolean[] value); IntentBuilder extra(String name, char[] value); IntentBuilder extra(String name, double[] value); IntentBuilder extra(String name, float[] value); IntentBuilder extra(String name, int[] value); IntentBuilder extra(String name, long[] value); IntentBuilder extra(String name, short[] value); IntentBuilder extra(String name, Bundle value); IntentBuilder extra(String name, CharSequence value); IntentBuilder extra(String name, Parcelable value); IntentBuilder extra(String name, Serializable value); IntentBuilder extra(String name, CharSequence[] value); IntentBuilder extra(String name, Parcelable[] value); IntentBuilder extra(String name, String[] value); IntentBuilder extraCharSequenceList(String name, ArrayList<CharSequence> value); IntentBuilder extraIntegerList(String name, ArrayList<Integer> value); IntentBuilder extraParcelableList(String name, ArrayList<? extends Parcelable> value); IntentBuilder extraStringList(String name, ArrayList<String> value); Intent build();  }
@Test(expected = IllegalArgumentException.class) public void extraIntArrayBlankKey() { new IntentBuilder().extra("", new int[]{1}); }
@Test(expected = IllegalArgumentException.class) public void extraIntArrayNullValue() { int[] array = null; new IntentBuilder().extra("my_key", array); }
@Test(expected = IllegalArgumentException.class) public void extraIntArrayEmptyValue() { int[] array = new int[]{}; new IntentBuilder().extra("my_key", array); }
@Test public void extraIntArray() { int[] array = new int[]{1}; Intent mock = mock(Intent.class); new IntentBuilder(mock).extra("my_key", array); verify(mock, times(1)).putExtra("my_key", array); }
@Test(expected = IllegalArgumentException.class) public void extraLongArrayNullKey() { new IntentBuilder().extra(null, new long[]{1l}); }
@Test(expected = IllegalArgumentException.class) public void extraLongArrayBlankKey() { new IntentBuilder().extra("", new long[]{1l}); }
@Test(expected = IllegalArgumentException.class) public void extraLongArrayNullValue() { long[] array = null; new IntentBuilder().extra("my_key", array); }
@Test(expected = IllegalArgumentException.class) public void extraLongArrayEmptyValue() { long[] array = new long[]{}; new IntentBuilder().extra("my_key", array); }
@Test public void extraLongArray() { long[] array = new long[]{1l}; Intent mock = mock(Intent.class); new IntentBuilder(mock).extra("my_key", array); verify(mock, times(1)).putExtra("my_key", array); }
@Test(expected = IllegalArgumentException.class) public void extraShortArrayNullKey() { new IntentBuilder().extra(null, new short[]{(short) 1}); }
@Test(expected = IllegalArgumentException.class) public void extraShortArrayBlankKey() { new IntentBuilder().extra("", new short[]{(short) 1}); }
@Test(expected = IllegalArgumentException.class) public void extraShortArrayNullValue() { short[] array = null; new IntentBuilder().extra("my_key", array); }
@Test(expected = IllegalArgumentException.class) public void extraShortArrayEmptyValue() { short[] array = new short[]{}; new IntentBuilder().extra("my_key", array); }
@Test public void extraShortArray() { short[] array = new short[]{(short) 1}; Intent mock = mock(Intent.class); new IntentBuilder(mock).extra("my_key", array); verify(mock, times(1)).putExtra("my_key", array); }
@Test(expected = IllegalArgumentException.class) public void extraBundleNullKey() { new IntentBuilder().extra(null, new Bundle()); }
@Test(expected = IllegalArgumentException.class) public void extraBundleBlankKey() { new IntentBuilder().extra("", new Bundle()); }
@Test(expected = IllegalArgumentException.class) public void extraBundleNullValue() { Bundle bundle = null; new IntentBuilder().extra("my_key", bundle); }
@Test public void extraBundle() { Bundle bundle = new Bundle(); Intent mock = mock(Intent.class); new IntentBuilder(mock).extra("my_key", bundle); verify(mock, times(1)).putExtra("my_key", bundle); }
@Test(expected = IllegalArgumentException.class) public void extraCharSequenceNullKey() { CharSequence sequence = "my_value"; new IntentBuilder().extra(null, sequence); }
@Test(expected = IllegalArgumentException.class) public void extraCharSequenceBlankKey() { CharSequence sequence = "my_value"; new IntentBuilder().extra("", sequence); }
@Test(expected = IllegalArgumentException.class) public void extraCharSequenceNullValue() { CharSequence sequence = null; new IntentBuilder().extra("my_key", sequence); }
@Test(expected = IllegalArgumentException.class) public void extraCharSequenceBlankValue() { CharSequence sequence = ""; new IntentBuilder().extra("my_key", sequence); }
@Test public void extraCharSequence() { CharSequence sequence = "my_value"; Intent mock = mock(Intent.class); new IntentBuilder(mock).extra("my_key", sequence); verify(mock, times(1)).putExtra("my_key", sequence); }
@Test(expected = IllegalArgumentException.class) public void extraParcelableNullKey() { Parcelable parcelable = new MyObject(); new IntentBuilder().extra(null, parcelable); }
@Test(expected = IllegalArgumentException.class) public void extraParcelableBlankKey() { Parcelable parcelable = new MyObject(); new IntentBuilder().extra("", parcelable); }
@Test(expected = IllegalArgumentException.class) public void extraParcelableNullValue() { Parcelable parcelable = null; new IntentBuilder().extra("my_key", parcelable); }
@Test public void extraParcelable() { Parcelable parcelable = new MyObject(); Intent mock = mock(Intent.class); new IntentBuilder(mock).extra("my_key", parcelable); verify(mock, times(1)).putExtra("my_key", parcelable); }
@Test(expected = IllegalArgumentException.class) public void extraSerializableNullKey() { Serializable serializable = new MyObject(); new IntentBuilder().extra(null, serializable); }
@Test(expected = IllegalArgumentException.class) public void extraSerializableBlankKey() { Serializable serializable = new MyObject(); new IntentBuilder().extra("", serializable); }
@Test(expected = IllegalArgumentException.class) public void extraSerializableNullValue() { Serializable serializable = null; new IntentBuilder().extra("my_key", serializable); }
@Test public void extraSerializable() { Serializable serializable = new MyObject(); Intent mock = mock(Intent.class); new IntentBuilder(mock).extra("my_key", serializable); verify(mock, times(1)).putExtra("my_key", serializable); }
@Test(expected = IllegalArgumentException.class) public void extraCharSequenceArrayNullKey() { CharSequence[] array = new CharSequence[]{"value"}; new IntentBuilder().extra(null, array); }
@Test(expected = IllegalArgumentException.class) public void extraCharSequenceArrayBlankKey() { CharSequence[] array = new CharSequence[]{"value"}; new IntentBuilder().extra("", array); }
@Test(expected = IllegalArgumentException.class) public void extraCharSequenceArrayNullValue() { CharSequence[] array = null; new IntentBuilder().extra("my_key", array); }
@Test(expected = IllegalArgumentException.class) public void extraCharSequenceArrayEmptyValue() { CharSequence[] array = new CharSequence[]{}; new IntentBuilder().extra("my_key", array); }
@Test public void extraCharSequenceArray() { CharSequence[] array = new CharSequence[]{"value"}; Intent mock = mock(Intent.class); new IntentBuilder(mock).extra("my_key", array); verify(mock, times(1)).putExtra("my_key", array); }
@Test(expected = IllegalArgumentException.class) public void extraParcelableArrayNullKey() { Parcelable[] array = new Parcelable[]{new MyObject()}; new IntentBuilder().extra(null, array); }
@Test(expected = IllegalArgumentException.class) public void extraParcelableArrayBlankKey() { Parcelable[] array = new Parcelable[]{new MyObject()}; new IntentBuilder().extra("", array); }
@Test(expected = IllegalArgumentException.class) public void extraParcelableArrayNullValue() { Parcelable[] array = null; new IntentBuilder().extra("my_key", array); }
@Test(expected = IllegalArgumentException.class) public void extraParcelableArrayEmptyValue() { Intent mock = mock(Intent.class); Parcelable[] array = new Parcelable[]{}; new IntentBuilder(mock).extra("my_key", array); }
@Test public void extraParcelableArray() { Parcelable[] array = new Parcelable[]{new MyObject()}; Intent mock = mock(Intent.class); new IntentBuilder(mock).extra("my_key", array); verify(mock, times(1)).putExtra("my_key", array); }
@Test(expected = IllegalArgumentException.class) public void extraStringArrayNullKey() { String[] array = new String[]{"value"}; new IntentBuilder().extra(null, array); }
@Test(expected = IllegalArgumentException.class) public void extraStringArrayBlankKey() { String[] array = new String[]{"value"}; new IntentBuilder().extra("", array); }
@Test(expected = IllegalArgumentException.class) public void extraStringArrayNullValue() { String[] array = null; new IntentBuilder().extra("my_key", array); }
@Test(expected = IllegalArgumentException.class) public void extraStringArrayEmptyValue() { String[] array = new String[]{}; new IntentBuilder().extra("my_key", array); }
@Test public void extraStringArray() { String[] array = new String[]{"value"}; Intent mock = mock(Intent.class); new IntentBuilder(mock).extra("my_key", array); verify(mock, times(1)).putExtra("my_key", array); }
@Test(expected = IllegalArgumentException.class) public void extraBooleanNullKey() { new IntentBuilder().extra(null, false); }
@Test(expected = IllegalArgumentException.class) public void extraBooleanBlankKey() { new IntentBuilder().extra("", false); }
@Test public void extraBoolean() { Intent mock = mock(Intent.class); new IntentBuilder(mock).extra("my_key", false); verify(mock, times(1)).putExtra("my_key", false); }
@Test(expected = IllegalArgumentException.class) public void extraByteNullKey() { new IntentBuilder().extra(null, (byte) 1); }
@Test(expected = IllegalArgumentException.class) public void extraByteBlankKey() { new IntentBuilder().extra("", (byte) 1); }
@Test public void extraByte() { Intent mock = mock(Intent.class); new IntentBuilder(mock).extra("my_key", (byte) 1); verify(mock, times(1)).putExtra("my_key", (byte) 1); }
@Test(expected = IllegalArgumentException.class) public void extraCharNullKey() { new IntentBuilder().extra(null, 'c'); }
@Test(expected = IllegalArgumentException.class) public void extraCharBlankKey() { new IntentBuilder().extra("", 'c'); }
@Test public void extraChar() { Intent mock = mock(Intent.class); new IntentBuilder(mock).extra("my_key", 'c'); verify(mock, times(1)).putExtra("my_key", 'c'); }
@Test(expected = IllegalArgumentException.class) public void extraDoubleNullKey() { new IntentBuilder().extra(null, 12.34d); }
@Test(expected = IllegalArgumentException.class) public void extraDoubleBlankKey() { new IntentBuilder().extra("", 12.34d); }
@Test public void extraDouble() { Intent mock = mock(Intent.class); new IntentBuilder(mock).extra("my_key", 12.34d); verify(mock, times(1)).putExtra("my_key", 12.34d); }
@Test(expected = IllegalArgumentException.class) public void extraFloatNullKey() { new IntentBuilder().extra(null, 12.34f); }
@Test(expected = IllegalArgumentException.class) public void extraFloatBlankKey() { new IntentBuilder().extra("", 12.34f); }
@Test public void extraFloat() { Intent mock = mock(Intent.class); new IntentBuilder(mock).extra("my_key", 12.34f); verify(mock, times(1)).putExtra("my_key", 12.34f); }
@Test(expected = IllegalArgumentException.class) public void extraIntNullKey() { new IntentBuilder().extra(null, 1); }
@Test(expected = IllegalArgumentException.class) public void extraIntBlankKey() { new IntentBuilder().extra("", 1); }
@Test public void extraInt() { Intent mock = mock(Intent.class); new IntentBuilder(mock).extra("my_key", 1); verify(mock, times(1)).putExtra("my_key", 1); }
@Test(expected = IllegalArgumentException.class) public void extraLongNullKey() { new IntentBuilder().extra(null, 1234l); }
@Test(expected = IllegalArgumentException.class) public void extraLongBlankKey() { new IntentBuilder().extra("", 1234l); }
@Test public void extraLong() { Intent mock = mock(Intent.class); new IntentBuilder(mock).extra("my_key", 1234l); verify(mock, times(1)).putExtra("my_key", 1234l); }
@Test(expected = IllegalArgumentException.class) public void extraShortNullKey() { new IntentBuilder().extra(null, (short) 12); }
@Test(expected = IllegalArgumentException.class) public void extraShortBlankKey() { new IntentBuilder().extra("", (short) 12); }
@Test public void extraShort() { Intent mock = mock(Intent.class); new IntentBuilder(mock).extra("my_key", (short) 12); verify(mock, times(1)).putExtra("my_key", (short) 12); }
@Test(expected = IllegalArgumentException.class) public void extraStringNullKey() { new IntentBuilder().extra(null, "string"); }
@Test(expected = IllegalArgumentException.class) public void extraStringBlankKey() { new IntentBuilder().extra("", "string"); }
@Test public void extraString() { Intent mock = mock(Intent.class); new IntentBuilder(mock).extra("my_key", "string"); verify(mock, times(1)).putExtra("my_key", "string"); }
@Test(expected = IllegalArgumentException.class) public void extraBooleanArrayNullKey() { new IntentBuilder().extra(null, new boolean[]{true}); }
@Test(expected = IllegalArgumentException.class) public void extraBooleanArrayBlankKey() { new IntentBuilder().extra("", new boolean[]{true}); }
@Test(expected = IllegalArgumentException.class) public void extraBooleanArrayNullValue() { boolean[] array = null; new IntentBuilder().extra("my_key", array); }
@Test(expected = IllegalArgumentException.class) public void extraBooleanArrayEmptyValue() { boolean[] array = new boolean[]{}; new IntentBuilder().extra("my_key", array); }
@Test public void extraBooleanArray() { boolean[] array = new boolean[]{true}; Intent mock = mock(Intent.class); new IntentBuilder(mock).extra("my_key", array); verify(mock, times(1)).putExtra("my_key", array); }
@Test(expected = IllegalArgumentException.class) public void extraByteArrayNullKey() { new IntentBuilder().extra(null, new byte[]{(byte) 1}); }
@Test(expected = IllegalArgumentException.class) public void extraByteArrayBlankKey() { new IntentBuilder().extra("", new byte[]{(byte) 1}); }
@Test(expected = IllegalArgumentException.class) public void extraByteArrayNullValue() { byte[] array = null; new IntentBuilder().extra("my_key", array); }
@Test(expected = IllegalArgumentException.class) public void extraByteArrayEmptyValue() { byte[] array = new byte[]{}; new IntentBuilder().extra("my_key", array); }
@Test public void extraByteArray() { byte[] array = new byte[]{(byte) 1}; Intent mock = mock(Intent.class); new IntentBuilder(mock).extra("my_key", array); verify(mock, times(1)).putExtra("my_key", array); }
@Test(expected = IllegalArgumentException.class) public void extraCharArrayNullKey() { new IntentBuilder().extra(null, new char[]{'a'}); }
@Test(expected = IllegalArgumentException.class) public void extraCharArrayBlankKey() { new IntentBuilder().extra("", new char[]{'a'}); }
@Test(expected = IllegalArgumentException.class) public void extraCharArrayNullValue() { char[] array = null; new IntentBuilder().extra("my_key", array); }
@Test(expected = IllegalArgumentException.class) public void extraCharArrayEmptyValue() { char[] array = new char[]{}; new IntentBuilder().extra("my_key", array); }
@Test public void extraCharArray() { char[] array = new char[]{'a'}; Intent mock = mock(Intent.class); new IntentBuilder(mock).extra("my_key", array); verify(mock, times(1)).putExtra("my_key", array); }
@Test(expected = IllegalArgumentException.class) public void extraDoubleArrayNullKey() { new IntentBuilder().extra(null, new double[]{1.2d}); }
@Test(expected = IllegalArgumentException.class) public void extraDoubleArrayBlankKey() { new IntentBuilder().extra("", new double[]{1.2d}); }
@Test(expected = IllegalArgumentException.class) public void extraDoubleArrayNullValue() { double[] array = null; new IntentBuilder().extra("my_key", array); }
@Test(expected = IllegalArgumentException.class) public void extraDoubleArrayEmptyValue() { double[] array = new double[]{}; new IntentBuilder().extra("my_key", array); }
@Test public void extraDoubleArray() { double[] array = new double[]{1.2d}; Intent mock = mock(Intent.class); new IntentBuilder(mock).extra("my_key", array); verify(mock, times(1)).putExtra("my_key", array); }
@Test(expected = IllegalArgumentException.class) public void extraFloatArrayNullKey() { new IntentBuilder().extra(null, new float[]{1.2f}); }
@Test(expected = IllegalArgumentException.class) public void extraFloatArrayBlankKey() { new IntentBuilder().extra("", new float[]{1.2f}); }
@Test(expected = IllegalArgumentException.class) public void extraFloatArrayNullValue() { float[] array = null; new IntentBuilder().extra("my_key", array); }
@Test(expected = IllegalArgumentException.class) public void extraFloatArrayEmptyValue() { float[] array = new float[]{}; new IntentBuilder().extra("my_key", array); }
@Test public void extraFloatArray() { float[] array = new float[]{1.2f}; Intent mock = mock(Intent.class); new IntentBuilder(mock).extra("my_key", array); verify(mock, times(1)).putExtra("my_key", array); }
@Test(expected = IllegalArgumentException.class) public void extraIntArrayNullKey() { new IntentBuilder().extra(null, new int[]{1}); }