@Test(expectedExceptions = IllegalStateException.class, expectedExceptionsMessageRegExp = "Test exception") public void absenceOfAnIterableTest6() { var start = currentTimeMillis(); try { assertThat(testContext.absence(new TestGetSupplier<>(new FunctionThatReturnsIterable(ofSeconds(10)).run()), ofSeconds(5), "Test exception"), is(false)); } catch (Throwable t) { var end = currentTimeMillis(); assertThat(new BigDecimal(end - start), closeTo(new BigDecimal(ofSeconds(5).toMillis()), new BigDecimal(500))); throw t; } fail("Exception was expected"); }
private Absence(Function<T, ?> toBeAbsent) { super("Absence of " + (isLoggable(toBeAbsent) ? toBeAbsent.toString() : "<not described value>"), o -> ofNullable(o) .map(o1 -> { Class<?> clazz = o1.getClass(); if (Boolean.class.isAssignableFrom(clazz)) { return (Boolean) o; } return false; }) .orElse(false)); StepFunction<T, ?> expectedToBeAbsent; if (StepFunction.class.isAssignableFrom(toBeAbsent.getClass())) { expectedToBeAbsent = ((StepFunction<T, ?>) toBeAbsent); } else { expectedToBeAbsent = new StepFunction<>(isLoggable(toBeAbsent) ? toBeAbsent.toString() : "<not described value>", toBeAbsent); } from(expectedToBeAbsent.turnReportingOff() .addIgnored(Throwable.class)); }
Absence extends SequentialGetStepSupplier.GetObjectChainedStepSupplier<T, Boolean, Object, Absence<T>> { private Absence(Function<T, ?> toBeAbsent) { super("Absence of " + (isLoggable(toBeAbsent) ? toBeAbsent.toString() : "<not described value>"), o -> ofNullable(o) .map(o1 -> { Class<?> clazz = o1.getClass(); if (Boolean.class.isAssignableFrom(clazz)) { return (Boolean) o; } return false; }) .orElse(false)); StepFunction<T, ?> expectedToBeAbsent; if (StepFunction.class.isAssignableFrom(toBeAbsent.getClass())) { expectedToBeAbsent = ((StepFunction<T, ?>) toBeAbsent); } else { expectedToBeAbsent = new StepFunction<>(isLoggable(toBeAbsent) ? toBeAbsent.toString() : "<not described value>", toBeAbsent); } from(expectedToBeAbsent.turnReportingOff() .addIgnored(Throwable.class)); } }
Absence extends SequentialGetStepSupplier.GetObjectChainedStepSupplier<T, Boolean, Object, Absence<T>> { private Absence(Function<T, ?> toBeAbsent) { super("Absence of " + (isLoggable(toBeAbsent) ? toBeAbsent.toString() : "<not described value>"), o -> ofNullable(o) .map(o1 -> { Class<?> clazz = o1.getClass(); if (Boolean.class.isAssignableFrom(clazz)) { return (Boolean) o; } return false; }) .orElse(false)); StepFunction<T, ?> expectedToBeAbsent; if (StepFunction.class.isAssignableFrom(toBeAbsent.getClass())) { expectedToBeAbsent = ((StepFunction<T, ?>) toBeAbsent); } else { expectedToBeAbsent = new StepFunction<>(isLoggable(toBeAbsent) ? toBeAbsent.toString() : "<not described value>", toBeAbsent); } from(expectedToBeAbsent.turnReportingOff() .addIgnored(Throwable.class)); } private  Absence(Function<T, ?> toBeAbsent); private  Absence(SequentialGetStepSupplier<T, ?, ?, ?, ?> toBeAbsent); }
Absence extends SequentialGetStepSupplier.GetObjectChainedStepSupplier<T, Boolean, Object, Absence<T>> { private Absence(Function<T, ?> toBeAbsent) { super("Absence of " + (isLoggable(toBeAbsent) ? toBeAbsent.toString() : "<not described value>"), o -> ofNullable(o) .map(o1 -> { Class<?> clazz = o1.getClass(); if (Boolean.class.isAssignableFrom(clazz)) { return (Boolean) o; } return false; }) .orElse(false)); StepFunction<T, ?> expectedToBeAbsent; if (StepFunction.class.isAssignableFrom(toBeAbsent.getClass())) { expectedToBeAbsent = ((StepFunction<T, ?>) toBeAbsent); } else { expectedToBeAbsent = new StepFunction<>(isLoggable(toBeAbsent) ? toBeAbsent.toString() : "<not described value>", toBeAbsent); } from(expectedToBeAbsent.turnReportingOff() .addIgnored(Throwable.class)); } private  Absence(Function<T, ?> toBeAbsent); private  Absence(SequentialGetStepSupplier<T, ?, ?, ?, ?> toBeAbsent); static Absence<T> absence(Function<T, ?> function); static Absence<T> absence(SequentialGetStepSupplier<T, ?, ?, ?, ?> toBeAbsent); @Override Absence<T> timeOut(Duration timeOut); Absence<T> throwIfPresent(String exceptionMessage); }
Absence extends SequentialGetStepSupplier.GetObjectChainedStepSupplier<T, Boolean, Object, Absence<T>> { private Absence(Function<T, ?> toBeAbsent) { super("Absence of " + (isLoggable(toBeAbsent) ? toBeAbsent.toString() : "<not described value>"), o -> ofNullable(o) .map(o1 -> { Class<?> clazz = o1.getClass(); if (Boolean.class.isAssignableFrom(clazz)) { return (Boolean) o; } return false; }) .orElse(false)); StepFunction<T, ?> expectedToBeAbsent; if (StepFunction.class.isAssignableFrom(toBeAbsent.getClass())) { expectedToBeAbsent = ((StepFunction<T, ?>) toBeAbsent); } else { expectedToBeAbsent = new StepFunction<>(isLoggable(toBeAbsent) ? toBeAbsent.toString() : "<not described value>", toBeAbsent); } from(expectedToBeAbsent.turnReportingOff() .addIgnored(Throwable.class)); } private  Absence(Function<T, ?> toBeAbsent); private  Absence(SequentialGetStepSupplier<T, ?, ?, ?, ?> toBeAbsent); static Absence<T> absence(Function<T, ?> function); static Absence<T> absence(SequentialGetStepSupplier<T, ?, ?, ?, ?> toBeAbsent); @Override Absence<T> timeOut(Duration timeOut); Absence<T> throwIfPresent(String exceptionMessage);  }