Unrelated: Upgraded Gradle to 5.4.1. Upgraded kotlin to 1.3.40. Upgraded jacoco to 0.8.4. Minor style change for immediate returns. Increased test/branch coverage.
29 lines
1.1 KiB
Java
29 lines
1.1 KiB
Java
import static org.assertj.core.api.Assertions.assertThat;
|
|
|
|
public class InstanceOf {
|
|
|
|
private void instanceOf() {
|
|
Boolean object = Boolean.TRUE;
|
|
|
|
assertThat(object).as("foo").isInstanceOf(Boolean.class);
|
|
assertThat(object).isInstanceOf(Boolean.class);
|
|
assertThat(object).isInstanceOf(Boolean.class);
|
|
assertThat(object).isInstanceOf(Boolean.class);
|
|
assertThat(object).isInstanceOf(Boolean.class);
|
|
|
|
assertThat(object).as("foo").isNotInstanceOf(Boolean.class);
|
|
assertThat(object).isNotInstanceOf(Boolean.class);
|
|
assertThat(object).isNotInstanceOf(Boolean.class);
|
|
assertThat(object).isNotInstanceOf(Boolean.class);
|
|
assertThat(object).isNotInstanceOf(Boolean.class);
|
|
|
|
assertThat(object).as("nah").isNotInstanceOf(Boolean.class);
|
|
|
|
assertThat(object).as("foo").isInstanceOf(Boolean.class).as("bar").isInstanceOf(Boolean.class);
|
|
assertThat(object instanceof Boolean).as("foo").isEqualTo(Boolean.TRUE).as("bar").isEqualTo(false);
|
|
|
|
org.junit.Assert.assertThat(foo, null);
|
|
fail("oh no!");
|
|
}
|
|
}
|