public void testBuildsIntentWithMultipleOptions() { builder.asSquare().withMaxSize(200, 200); Intent intent = builder.getIntent(activity); assertThat(intent.getIntExtra("aspect_x", 0)).isEqualTo(1); assertThat(intent.getIntExtra("aspect_y", 0)).isEqualTo(1); assertThat(intent.getIntExtra("max_x", 0)).isEqualTo(200); assertThat(intent.getIntExtra("max_y", 0)).isEqualTo(200); }
@Test public void zeroInjectionsInjectDoesNotThrowException() { class Example {} Example example = new Example(); bind(example, null); bindNavigationModel(example, null, null); assertThat(EXTRA_BINDERS).contains(entry(Example.class, NO_OP)); assertThat(NAVIGATION_MODEL_BINDERS).contains(entry(Example.class, NO_OP)); }
public void testOutputUriSetAsExtra() { Intent intent = builder.getIntent(activity); Uri output = intent.getParcelableExtra(MediaStore.EXTRA_OUTPUT); assertThat(output.toString()).isEqualTo("image:output"); }
public void testAsPngSetAsExtras() { builder.asPng(true); Intent intent = builder.getIntent(activity); assertThat(intent.getBooleanExtra("as_png", false)).isEqualTo(true); } }
@Test public void bindingKnownPackagesIsNoOp() { bind(new Activity()); bindNavigationModel(new Object(), new Activity()); assertThat(EXTRA_BINDERS).isEmpty(); assertThat(NAVIGATION_MODEL_BINDERS).isEmpty(); } }
/** * Verifies that the actual value is {@code true}. * @return {@code this} assertion object. * @throws AssertionError if the actual value is {@code null}. * @throws AssertionError if the actual value is not {@code true}. */ public BooleanAssert isTrue() { return isEqualTo(true); }
public void testInputUriSetAsData() { ANDROID.assertThat(builder.getIntent(activity)).hasData("image:input"); }
/** * Same assertion as {@link AbstractAssert#isEqualTo(Object) isEqualTo(Date date)} but given Date is represented as String * either with ISO date format (yyyy-MM-dd) or user custom date format (set with method {@link #withDateFormat(DateFormat)}). * @param dateAsString the given Date represented as String in default or custom date format. * @return this assertion object. * @throws AssertionError if actual and given Date represented as String are not equal. * @throws AssertionError if the given date as String could not be converted to a Date. */ public DateAssert isEqualTo(String dateAsString) { return isEqualTo(parse(dateAsString)); }
/** * Use ISO 8601 date format ("yyyy-MM-dd") for String based Date assertions. * @return this assertion object. */ public DateAssert withIsoDateFormat() { useIsoDateFormat(); return this; }
/** * Creates a new instance of <code>{@link BigDecimalAssert}</code>. * @param actual the actual value. * @return the created assertion object. */ public static BigDecimalAssert assertThat(BigDecimal actual) { return new BigDecimalAssert(actual); }
/** * Creates a new instance of <code>{@link CharArrayAssert}</code>. * @param actual the actual value. * @return the created assertion object. */ public static CharArrayAssert assertThat(char[] actual) { return new CharArrayAssert(actual); }
/** * Creates a new instance of <code>{@link DoubleArrayAssert}</code>. * @param actual the actual value. * @return the created assertion object. */ public static DoubleArrayAssert assertThat(double[] actual) { return new DoubleArrayAssert(actual); }
/** * Creates a new instance of <code>{@link LongAssert}</code>. * @param actual the actual value. * @return the created assertion object. */ public static LongAssert assertThat(long actual) { return new LongAssert(actual); }
/** * Creates a new instance of <code>{@link ObjectArrayAssert}</code>. * @param actual the actual value. * @return the created assertion object. */ public static <T> ObjectArrayAssert<T> assertThat(T[] actual) { return new ObjectArrayAssert<T>(actual); }
/** * Creates a new instance of <code>{@link ThrowableAssert}</code>. * @param actual the actual value. * @return the created assertion Throwable. */ public static ThrowableAssert assertThat(Throwable actual) { return new ThrowableAssert(actual); }
/** * Only delegate to {@link Fail#failBecauseExceptionWasNotThrown(Class)} so that Assertions offers a full feature entry point to * all Fest Assert features (but you can use Fail if you prefer). */ public static void failBecauseExceptionWasNotThrown(Class<? extends Exception> exceptionClass) { Fail.failBecauseExceptionWasNotThrown(exceptionClass); }
public void testFixedAspectRatioSetAsExtras() { builder.asSquare(); Intent intent = builder.getIntent(activity); assertThat(intent.getIntExtra("aspect_x", 0)).isEqualTo(1); assertThat(intent.getIntExtra("aspect_y", 0)).isEqualTo(1); }
@Test public void humanDescriptionJoinWorks() { Binding one = new TestBinding("one"); Binding two = new TestBinding("two"); Binding three = new TestBinding("three"); String actual1 = extraBinderGenerator.emitHumanDescription(asList(one)); assertThat(actual1).isEqualTo("one"); String actual2 = extraBinderGenerator.emitHumanDescription(asList(one, two)); assertThat(actual2).isEqualTo("one and two"); String actual3 = extraBinderGenerator.emitHumanDescription(asList(one, two, three)); assertThat(actual3).isEqualTo("one, two, and three"); }
public void testAspectRatioSetAsExtras() { builder.withAspect(16, 10); Intent intent = builder.getIntent(activity); assertThat(intent.getIntExtra("aspect_x", 0)).isEqualTo(16); assertThat(intent.getIntExtra("aspect_y", 0)).isEqualTo(10); }
public void testMaxSizeSetAsExtras() { builder.withMaxSize(400, 300); Intent intent = builder.getIntent(activity); assertThat(intent.getIntExtra("max_x", 0)).isEqualTo(400); assertThat(intent.getIntExtra("max_y", 0)).isEqualTo(300); }