### Question:
Presence extends SequentialGetStepSupplier.GetObjectChainedStepSupplier<T, Boolean, Object, Presence<T>> { private Presence(Function<T, ?> toBePresent) { super("Presence of " + (isLoggable(toBePresent) ? toBePresent.toString() : "<not described value>"), o -> ofNullable(o) .map(o1 -> { Class<?> clazz = o1.getClass(); if (Boolean.class.isAssignableFrom(clazz)) { return (Boolean) o1; } if (Iterable.class.isAssignableFrom(clazz)) { return Iterables.size((Iterable) o1) > 0; } if (clazz.isArray()) { return Array.getLength(o1) > 0; } return true; }) .orElse(false)); StepFunction<T, ?> expectedToBePresent; if (StepFunction.class.isAssignableFrom(toBePresent.getClass())) { expectedToBePresent = ((StepFunction<T, ?>) toBePresent); } else { expectedToBePresent = new StepFunction<>(isLoggable(toBePresent) ? toBePresent.toString() : "<not described value>", toBePresent); } from(expectedToBePresent.turnReportingOff()); } private  Presence(Function<T, ?> toBePresent); private  Presence(SequentialGetStepSupplier<T, ?, ?, ?, ?> toBePresent); static Presence<T> presence(Function<T, ?> function); static Presence<T> presence(SequentialGetStepSupplier<T, ?, ?, ?, ?> toBePresent); @Override Presence<T> addIgnored(Collection<Class<? extends Throwable>> toBeIgnored); @Override Presence<T> addIgnored(Class<? extends Throwable> toBeIgnored); Presence<T> throwIfNotPresent(Supplier<? extends RuntimeException> exceptionSupplier);  }### Answer:
@Test public void testOfFunctionWhichReturnsValue() { assertThat(presenceTestContext.presence(RETURNS_OBJECT), is(true)); }
@Test public void testOfFunctionWhichReturnsNull() { assertThat(presenceTestContext.presence(RETURNS_NULL), is(false)); }
@Test public void testOfFunctionWhichReturnsArray() { assertThat(presenceTestContext.presence(RETURNS_OBJECT_ARRAY), is(true)); }
@Test public void testOfFunctionWhichReturnsEmptyArray() { assertThat(presenceTestContext.presence(RETURNS_EMPTY_ARRAY), is(false)); }
@Test public void testOfFunctionWhichReturnsIterable() { assertThat(presenceTestContext.presence(RETURNS_OBJECT_ITERABLE), is(true)); }
@Test public void testOfFunctionWhichReturnsEmptyIterable() { assertThat(presenceTestContext.presence(RETURNS_EMPTY_ITERABLE), is(false)); }
@Test public void testOfFunctionWhichReturnsTrue() { assertThat(presenceTestContext.presence(RETURNS_TRUE), is(true)); }
@Test public void testOfFunctionWhichReturnsFalse() { assertThat(presenceTestContext.presence(RETURNS_FALSE), is(false)); }
@Test public void testOfFunctionWhichThrowsIgnoredException() { assertThat(presenceTestContext.presence(PRODUCES_IGNORED_EXCEPTIONS, IGNORED_EXCEPTIONS.toArray(new Class[]{})), is(false)); }
@Test(expectedExceptions = RuntimeException.class, expectedExceptionsMessageRegExp = "Expected exception to be thrown") public void testOfFunctionWhichThrowsExpectedException() { assertThat(presenceTestContext.presence(PRODUCES_EXPECTED_EXCEPTIONS), is(false)); }
@Test(expectedExceptions = IllegalStateException.class, expectedExceptionsMessageRegExp = "Test exception") public void testOfThrowingExceptionIfNotPresentFunction() { var errorToThrow = new IllegalStateException("Test exception"); assertThat(presenceTestContext.presence(RETURNS_NULL, () -> errorToThrow), is(false)); }