diff --git a/assertj-core/src/main/java/org/assertj/core/api/InstanceOfAssertFactories.java b/assertj-core/src/main/java/org/assertj/core/api/InstanceOfAssertFactories.java index d81f591ff5..8de6776ac9 100644 --- a/assertj-core/src/main/java/org/assertj/core/api/InstanceOfAssertFactories.java +++ b/assertj-core/src/main/java/org/assertj/core/api/InstanceOfAssertFactories.java @@ -596,16 +596,15 @@ static InstanceOfAssertFactory the {@code AtomicIntegerFieldUpdater} object type. + * @param the {@code AtomicIntegerFieldUpdater} object type. * @param objectType the object type instance. * @return the factory instance. * * @see #ATOMIC_INTEGER_FIELD_UPDATER */ @SuppressWarnings("rawtypes") - static InstanceOfAssertFactory> atomicIntegerFieldUpdater(Class objectType) { - return new InstanceOfAssertFactory<>(AtomicIntegerFieldUpdater.class, new Class[] { objectType }, - Assertions:: assertThat); + static InstanceOfAssertFactory> atomicIntegerFieldUpdater(Class objectType) { + return new InstanceOfAssertFactory<>(AtomicIntegerFieldUpdater.class, new Class[] { objectType }, Assertions:: assertThat); } /** @@ -637,16 +636,15 @@ static InstanceOfAssertFactory the {@code AtomicLongFieldUpdater} object type. + * @param the {@code AtomicLongFieldUpdater} object type. * @param objectType the object type instance. * @return the factory instance. * * @see #ATOMIC_LONG_FIELD_UPDATER */ @SuppressWarnings("rawtypes") - static InstanceOfAssertFactory> atomicLongFieldUpdater(Class objectType) { - return new InstanceOfAssertFactory<>(AtomicLongFieldUpdater.class, new Class[] { objectType }, - Assertions:: assertThat); + static InstanceOfAssertFactory> atomicLongFieldUpdater(Class objectType) { + return new InstanceOfAssertFactory<>(AtomicLongFieldUpdater.class, new Class[] { objectType }, Assertions:: assertThat); } /** @@ -660,15 +658,15 @@ static InstanceOfAssertFactory the {@code AtomicReference} value type. + * @param the {@code AtomicReference} value type. * @param valueType the value type instance. * @return the factory instance. * * @see #ATOMIC_REFERENCE */ @SuppressWarnings("rawtypes") - static InstanceOfAssertFactory> atomicReference(Class valueType) { - return new InstanceOfAssertFactory<>(AtomicReference.class, new Class[] { valueType }, Assertions:: assertThat); + static InstanceOfAssertFactory> atomicReference(Class valueType) { + return new InstanceOfAssertFactory<>(AtomicReference.class, new Class[] { valueType }, Assertions:: assertThat); } /** @@ -682,16 +680,15 @@ static InstanceOfAssertFactory the {@code AtomicReferenceArray} element type. + * @param the {@code AtomicReferenceArray} element type. * @param elementType the element type instance. * @return the factory instance. * * @see #ATOMIC_REFERENCE_ARRAY */ @SuppressWarnings("rawtypes") - static InstanceOfAssertFactory> atomicReferenceArray(Class elementType) { - return new InstanceOfAssertFactory<>(AtomicReferenceArray.class, new Class[] { elementType }, - Assertions:: assertThat); + static InstanceOfAssertFactory> atomicReferenceArray(Class elementType) { + return new InstanceOfAssertFactory<>(AtomicReferenceArray.class, new Class[] { elementType }, Assertions:: assertThat); } /** @@ -706,8 +703,8 @@ static InstanceOfAssertFactory the {@code AtomicReferenceFieldUpdater} field type. - * @param the {@code AtomicReferenceFieldUpdater} object type. + * @param the {@code AtomicReferenceFieldUpdater} field type. + * @param the {@code AtomicReferenceFieldUpdater} object type. * @param fieldType the field type instance. * @param objectType the object type instance. * @return the factory instance. @@ -715,10 +712,10 @@ static InstanceOfAssertFactory InstanceOfAssertFactory> atomicReferenceFieldUpdater(Class fieldType, - Class objectType) { + static InstanceOfAssertFactory> atomicReferenceFieldUpdater(Class fieldType, + Class objectType) { return new InstanceOfAssertFactory<>(AtomicReferenceFieldUpdater.class, new Class[] { fieldType, objectType }, - Assertions:: assertThat); + Assertions:: assertThat); } /** @@ -732,16 +729,15 @@ static InstanceOfAssertFactory the {@code AtomicMarkableReference} value type. + * @param the {@code AtomicMarkableReference} value type. * @param valueType the value type instance. * @return the factory instance. * * @see #ATOMIC_MARKABLE_REFERENCE */ @SuppressWarnings("rawtypes") - static InstanceOfAssertFactory> atomicMarkableReference(Class valueType) { - return new InstanceOfAssertFactory<>(AtomicMarkableReference.class, new Class[] { valueType }, - Assertions:: assertThat); + static InstanceOfAssertFactory> atomicMarkableReference(Class valueType) { + return new InstanceOfAssertFactory<>(AtomicMarkableReference.class, new Class[] { valueType }, Assertions:: assertThat); } /** @@ -755,15 +751,15 @@ static InstanceOfAssertFactory the {@code AtomicStampedReference} value type. + * @param the {@code AtomicStampedReference} value type. * @param valueType the value type instance. * @return the factory instance. * * @see #ATOMIC_STAMPED_REFERENCE */ @SuppressWarnings("rawtypes") - static InstanceOfAssertFactory> atomicStampedReference(Class valueType) { - return new InstanceOfAssertFactory<>(AtomicStampedReference.class, new Class[] { valueType }, Assertions:: assertThat); + static InstanceOfAssertFactory> atomicStampedReference(Class valueType) { + return new InstanceOfAssertFactory<>(AtomicStampedReference.class, new Class[] { valueType }, Assertions:: assertThat); } /** diff --git a/assertj-core/src/test/java/org/assertj/core/api/InstanceOfAssertFactoriesTest.java b/assertj-core/src/test/java/org/assertj/core/api/InstanceOfAssertFactoriesTest.java index a698356e78..f578703cbd 100644 --- a/assertj-core/src/test/java/org/assertj/core/api/InstanceOfAssertFactoriesTest.java +++ b/assertj-core/src/test/java/org/assertj/core/api/InstanceOfAssertFactoriesTest.java @@ -12,7 +12,9 @@ */ package org.assertj.core.api; +import static java.time.temporal.ChronoUnit.SECONDS; import static java.util.concurrent.CompletableFuture.completedFuture; +import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.entry; import static org.assertj.core.api.Assertions.within; import static org.assertj.core.api.BDDAssertions.from; @@ -125,12 +127,11 @@ import static org.assertj.core.api.InstanceOfAssertFactories.optional; import static org.assertj.core.api.InstanceOfAssertFactories.predicate; import static org.assertj.core.api.InstanceOfAssertFactories.set; -import static org.assertj.core.api.InstanceOfAssertFactories.spliterator; import static org.assertj.core.api.InstanceOfAssertFactories.stream; import static org.assertj.core.api.InstanceOfAssertFactories.throwable; import static org.assertj.core.api.InstanceOfAssertFactories.type; import static org.assertj.core.test.Maps.mapOf; -import static org.junit.jupiter.params.provider.Arguments.arguments; +import static org.mockito.AdditionalAnswers.delegatesTo; import static org.mockito.ArgumentMatchers.argThat; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; @@ -139,13 +140,11 @@ import java.io.File; import java.io.InputStream; import java.lang.reflect.ParameterizedType; -import java.lang.reflect.Type; import java.math.BigDecimal; import java.math.BigInteger; import java.net.MalformedURLException; import java.net.URI; import java.net.URL; -import java.nio.file.Path; import java.nio.file.Paths; import java.time.Duration; import java.time.Instant; @@ -157,19 +156,15 @@ import java.time.Period; import java.time.YearMonth; import java.time.ZonedDateTime; -import java.time.temporal.ChronoUnit; import java.time.temporal.Temporal; import java.util.Collection; import java.util.Date; -import java.util.Iterator; import java.util.List; -import java.util.Map; import java.util.Objects; import java.util.Optional; import java.util.OptionalDouble; import java.util.OptionalInt; import java.util.OptionalLong; -import java.util.Set; import java.util.Spliterator; import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletionStage; @@ -203,859 +198,2774 @@ import org.assertj.core.util.Lists; import org.assertj.core.util.Sets; import org.assertj.core.util.Strings; +import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.Arguments; -import org.junit.jupiter.params.provider.MethodSource; -import org.mockito.AdditionalAnswers; /** * @author Stefano Cordio */ class InstanceOfAssertFactoriesTest { - @Test - void predicate_factory_createAssert_should_create_predicate_assertions() { - // GIVEN - Object value = (Predicate) Objects::isNull; - // WHEN - PredicateAssert result = PREDICATE.createAssert(value); - // THEN - result.accepts((Object) null); + @Nested + class Predicate_Factory { + + private final Object actual = (Predicate) Objects::isNull; + + @Test + void getRawClass() { + // WHEN + Class result = PREDICATE.getRawClass(); + // THEN + then(result).isEqualTo(Predicate.class); + } + + @Test + void createAssert() { + // WHEN + PredicateAssert result = PREDICATE.createAssert(actual); + // THEN + result.accepts((Object) null); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + PredicateAssert result = PREDICATE.createAssert(valueProvider); + // THEN + result.accepts((Object) null); + verify(valueProvider).apply(parameterizedType(Predicate.class, Object.class)); + } + + } + + @Nested + class Predicate_Typed_Factory { + + private final Object actual = (Predicate) Strings::isNullOrEmpty; + + @Test + void getRawClass() { + // WHEN + Class result = PREDICATE.getRawClass(); + // THEN + then(result).isEqualTo(Predicate.class); + } + + @Test + void createAssert() { + // WHEN + PredicateAssert result = predicate(String.class).createAssert(actual); + // THEN + result.accepts(""); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + PredicateAssert result = predicate(String.class).createAssert(valueProvider); + // THEN + result.accepts(""); + verify(valueProvider).apply(parameterizedType(Predicate.class, String.class)); + } + + } + + @Nested + class IntPredicate_Factory { + + private final Object actual = (IntPredicate) i -> i == 0; + + @Test + void getRawClass() { + // WHEN + Class result = INT_PREDICATE.getRawClass(); + // THEN + then(result).isEqualTo(IntPredicate.class); + } + + @Test + void createAssert() { + // WHEN + IntPredicateAssert result = INT_PREDICATE.createAssert(actual); + // THEN + result.accepts(0); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + IntPredicateAssert result = INT_PREDICATE.createAssert(valueProvider); + // THEN + result.accepts(0); + verify(valueProvider).apply(IntPredicate.class); + } + + } + + @Nested + class LongPredicate_Factory { + + private final Object actual = (LongPredicate) l -> l == 0L; + + @Test + void getRawClass() { + // WHEN + Class result = LONG_PREDICATE.getRawClass(); + // THEN + then(result).isEqualTo(LongPredicate.class); + } + + @Test + void createAssert() { + // WHEN + LongPredicateAssert result = LONG_PREDICATE.createAssert(actual); + // THEN + result.accepts(0L); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + LongPredicateAssert result = LONG_PREDICATE.createAssert(valueProvider); + // THEN + result.accepts(0L); + verify(valueProvider).apply(LongPredicate.class); + } + + } + + @Nested + class DoublePredicate_Factory { + + private final Object actual = (DoublePredicate) d -> d == 0.0; + + @Test + void getRawClass() { + // WHEN + Class result = DOUBLE_PREDICATE.getRawClass(); + // THEN + then(result).isEqualTo(DoublePredicate.class); + } + + @Test + void createAssert() { + // WHEN + DoublePredicateAssert result = DOUBLE_PREDICATE.createAssert(actual); + // THEN + result.accepts(0.0); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + DoublePredicateAssert result = DOUBLE_PREDICATE.createAssert(valueProvider); + // THEN + result.accepts(0.0); + verify(valueProvider).apply(DoublePredicate.class); + } + + } + + @Nested + class CompletableFuture_Factory { + + private final Object actual = completedFuture("done"); + + @Test + void getRawClass() { + // WHEN + Class result = COMPLETABLE_FUTURE.getRawClass(); + // THEN + then(result).isEqualTo(CompletableFuture.class); + } + + @Test + void createAssert() { + // WHEN + CompletableFutureAssert result = COMPLETABLE_FUTURE.createAssert(actual); + // THEN + result.isDone(); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + CompletableFutureAssert result = COMPLETABLE_FUTURE.createAssert(valueProvider); + // THEN + result.isDone(); + verify(valueProvider).apply(parameterizedType(CompletableFuture.class, Object.class)); + } + + } + + @Nested + class CompletableFuture_Typed_Factory { + + private final Object actual = completedFuture("done"); + + @Test + void getRawClass() { + // WHEN + Class result = completableFuture(String.class).getRawClass(); + // THEN + then(result).isEqualTo(CompletableFuture.class); + } + + @Test + void createAssert() { + // WHEN + CompletableFutureAssert result = completableFuture(String.class).createAssert(actual); + // THEN + result.isDone(); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + CompletableFutureAssert result = completableFuture(String.class).createAssert(valueProvider); + // THEN + result.isDone(); + verify(valueProvider).apply(parameterizedType(CompletableFuture.class, String.class)); + } + + } + + @Nested + class CompletionStage_Factory { + + private final Object actual = completedFuture("done"); + + @Test + void getRawClass() { + // WHEN + Class result = COMPLETION_STAGE.getRawClass(); + // THEN + then(result).isEqualTo(CompletionStage.class); + } + + @Test + void createAssert() { + // WHEN + CompletableFutureAssert result = COMPLETION_STAGE.createAssert(actual); + // THEN + result.isDone(); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + CompletableFutureAssert result = COMPLETION_STAGE.createAssert(valueProvider); + // THEN + result.isDone(); + verify(valueProvider).apply(parameterizedType(CompletionStage.class, Object.class)); + } + + } + + @Nested + class CompletionStage_Typed_Factory { + + private final Object actual = completedFuture("done"); + + @Test + void getRawClass() { + // WHEN + Class result = COMPLETION_STAGE.getRawClass(); + // THEN + then(result).isEqualTo(CompletionStage.class); + } + + @Test + void createAssert() { + // WHEN + CompletableFutureAssert result = completionStage(String.class).createAssert(actual); + // THEN + result.isDone(); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + CompletableFutureAssert result = completionStage(String.class).createAssert(valueProvider); + // THEN + result.isDone(); + verify(valueProvider).apply(parameterizedType(CompletionStage.class, String.class)); + } + + } + + @Nested + class Optional_Factory { + + private final Object actual = Optional.of("something"); + + @Test + void getRawClass() { + // WHEN + Class result = OPTIONAL.getRawClass(); + // THEN + then(result).isEqualTo(Optional.class); + } + + @Test + void createAssert() { + // WHEN + OptionalAssert result = OPTIONAL.createAssert(actual); + // THEN + result.isPresent(); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + OptionalAssert result = OPTIONAL.createAssert(valueProvider); + // THEN + result.isPresent(); + verify(valueProvider).apply(parameterizedType(Optional.class, Object.class)); + } + + } + + @Nested + class Optional_Typed_Factory { + + private final Object actual = Optional.of("something"); + + @Test + void getRawClass() { + // WHEN + Class result = optional(String.class).getRawClass(); + // THEN + then(result).isEqualTo(Optional.class); + } + + @Test + void createAssert() { + // WHEN + OptionalAssert result = optional(String.class).createAssert(actual); + // THEN + result.isPresent(); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + OptionalAssert result = optional(String.class).createAssert(valueProvider); + // THEN + result.isPresent(); + verify(valueProvider).apply(parameterizedType(Optional.class, String.class)); + } + + } + + @Nested + class OptionalDouble_Factory { + + private final Object actual = OptionalDouble.of(0.0); + + @Test + void getRawClass() { + // WHEN + Class result = OPTIONAL_DOUBLE.getRawClass(); + // THEN + then(result).isEqualTo(OptionalDouble.class); + } + + @Test + void createAssert() { + // WHEN + OptionalDoubleAssert result = OPTIONAL_DOUBLE.createAssert(actual); + // THEN + result.isPresent(); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + OptionalDoubleAssert result = OPTIONAL_DOUBLE.createAssert(valueProvider); + // THEN + result.isPresent(); + verify(valueProvider).apply(OptionalDouble.class); + } + + } + + @Nested + class OptionalInt_Factory { + + private final Object actual = OptionalInt.of(0); + + @Test + void getRawClass() { + // WHEN + Class result = OPTIONAL_INT.getRawClass(); + // THEN + then(result).isEqualTo(OptionalInt.class); + } + + @Test + void createAssert() { + // WHEN + OptionalIntAssert result = OPTIONAL_INT.createAssert(actual); + // THEN + result.isPresent(); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + OptionalIntAssert result = OPTIONAL_INT.createAssert(valueProvider); + // THEN + result.isPresent(); + verify(valueProvider).apply(OptionalInt.class); + } + + } + + @Nested + class OptionalLong_Factory { + + private final Object actual = OptionalLong.of(0L); + + @Test + void getRawClass() { + // WHEN + Class result = OPTIONAL_LONG.getRawClass(); + // THEN + then(result).isEqualTo(OptionalLong.class); + } + + @Test + void createAssert() { + // WHEN + OptionalLongAssert result = OPTIONAL_LONG.createAssert(actual); + // THEN + result.isPresent(); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + OptionalLongAssert result = OPTIONAL_LONG.createAssert(valueProvider); + // THEN + result.isPresent(); + verify(valueProvider).apply(OptionalLong.class); + } + + } + + @Nested + class Matcher_Factory { + + private final Object actual = Pattern.compile("a*").matcher("aaa"); + + @Test + void getRawClass() { + // WHEN + Class result = MATCHER.getRawClass(); + // THEN + then(result).isEqualTo(Matcher.class); + } + + @Test + void createAssert() { + // WHEN + MatcherAssert result = MATCHER.createAssert(actual); + // THEN + result.matches(); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + MatcherAssert result = MATCHER.createAssert(valueProvider); + // THEN + result.matches(); + verify(valueProvider).apply(Matcher.class); + } + + } + + @Nested + class BigDecimal_Factory { + + private final Object actual = BigDecimal.valueOf(0.0); + + @Test + void getRawClass() { + // WHEN + Class result = BIG_DECIMAL.getRawClass(); + // THEN + then(result).isEqualTo(BigDecimal.class); + } + + @Test + void createAssert() { + // WHEN + AbstractBigDecimalAssert result = BIG_DECIMAL.createAssert(actual); + // THEN + result.isEqualTo("0.0"); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + AbstractBigDecimalAssert result = BIG_DECIMAL.createAssert(valueProvider); + // THEN + result.isEqualTo("0.0"); + verify(valueProvider).apply(BigDecimal.class); + } + + } + + @Nested + class BigInteger_Factory { + + private final Object actual = BigInteger.valueOf(0L); + + @Test + void getRawClass() { + // WHEN + Class result = BIG_INTEGER.getRawClass(); + // THEN + then(result).isEqualTo(BigInteger.class); + } + + @Test + void createAssert() { + // WHEN + AbstractBigIntegerAssert result = BIG_INTEGER.createAssert(actual); + // THEN + result.isEqualTo(0L); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + AbstractBigIntegerAssert result = BIG_INTEGER.createAssert(valueProvider); + // THEN + result.isEqualTo(0L); + verify(valueProvider).apply(BigInteger.class); + } + + } + + @Nested + class URI_Factory { + + private final Object actual = URI.create("http://localhost"); + + @Test + void getRawClass() { + // WHEN + Class result = URI_TYPE.getRawClass(); + // THEN + then(result).isEqualTo(URI.class); + } + + @Test + void createAssert() { + // WHEN + AbstractUriAssert result = URI_TYPE.createAssert(actual); + // THEN + result.hasHost("localhost"); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + AbstractUriAssert result = URI_TYPE.createAssert(valueProvider); + // THEN + result.hasHost("localhost"); + verify(valueProvider).apply(URI.class); + } + + } + + @Nested + class URL_Factory { + + private final Object actual = new URL("http://localhost"); + + URL_Factory() throws MalformedURLException {} + + @Test + void getRawClass() { + // WHEN + Class result = URL_TYPE.getRawClass(); + // THEN + then(result).isEqualTo(URL.class); + } + + @Test + void createAssert() { + // WHEN + AbstractUrlAssert result = URL_TYPE.createAssert(actual); + // THEN + result.hasHost("localhost"); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + AbstractUrlAssert result = URL_TYPE.createAssert(valueProvider); + // THEN + result.hasHost("localhost"); + verify(valueProvider).apply(URL.class); + } + + } + + @Nested + class Boolean_Factory { + + private final Object actual = true; + + @Test + void getRawClass() { + // WHEN + Class result = BOOLEAN.getRawClass(); + // THEN + then(result).isEqualTo(Boolean.class); + } + + @Test + void createAssert() { + // WHEN + AbstractBooleanAssert result = BOOLEAN.createAssert(actual); + // THEN + result.isTrue(); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + AbstractBooleanAssert result = BOOLEAN.createAssert(valueProvider); + // THEN + result.isTrue(); + verify(valueProvider).apply(Boolean.class); + } + + } + + @Nested + class Boolean_Array_Factory { + + private final Object actual = new boolean[] { true, false }; + + @Test + void getRawClass() { + // WHEN + Class result = BOOLEAN_ARRAY.getRawClass(); + // THEN + then(result).isEqualTo(boolean[].class); + } + + @Test + void createAssert() { + // WHEN + AbstractBooleanArrayAssert result = BOOLEAN_ARRAY.createAssert(actual); + // THEN + result.containsExactly(true, false); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + AbstractBooleanArrayAssert result = BOOLEAN_ARRAY.createAssert(valueProvider); + // THEN + result.containsExactly(true, false); + verify(valueProvider).apply(boolean[].class); + } + + } + + @Nested + class Boolean_2D_Array_Factory { + + private final Object actual = new boolean[][] { { true, false }, { false, true } }; + + @Test + void getRawClass() { + // WHEN + Class result = BOOLEAN_2D_ARRAY.getRawClass(); + // THEN + then(result).isEqualTo(boolean[][].class); + } + + @Test + void createAssert() { + // WHEN + Boolean2DArrayAssert result = BOOLEAN_2D_ARRAY.createAssert(actual); + // THEN + result.hasDimensions(2, 2); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + Boolean2DArrayAssert result = BOOLEAN_2D_ARRAY.createAssert(valueProvider); + // THEN + result.hasDimensions(2, 2); + verify(valueProvider).apply(boolean[][].class); + } + + } + + @Nested + class Byte_Factory { + + private final Object actual = (byte) 0; + + @Test + void getRawClass() { + // WHEN + Class result = BYTE.getRawClass(); + // THEN + then(result).isEqualTo(Byte.class); + } + + @Test + void createAssert() { + // WHEN + AbstractByteAssert result = BYTE.createAssert(actual); + // THEN + result.isEqualTo((byte) 0); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + AbstractByteAssert result = BYTE.createAssert(valueProvider); + // THEN + result.isEqualTo((byte) 0); + verify(valueProvider).apply(Byte.class); + } + + } + + @Nested + class Byte_Array_Factory { + + private final Object actual = new byte[] { 0, 1 }; + + @Test + void getRawClass() { + // WHEN + Class result = BYTE_ARRAY.getRawClass(); + // THEN + then(result).isEqualTo(byte[].class); + } + + @Test + void createAssert() { + // WHEN + AbstractByteArrayAssert result = BYTE_ARRAY.createAssert(actual); + // THEN + result.containsExactly(0, 1); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + AbstractByteArrayAssert result = BYTE_ARRAY.createAssert(valueProvider); + // THEN + result.containsExactly(0, 1); + verify(valueProvider).apply(byte[].class); + } + + } + + @Nested + class Byte_2D_Array_Factory { + + private final Object actual = new byte[][] { { 0, 1 }, { 2, 3 } }; + + @Test + void getRawClass() { + // WHEN + Class result = BYTE_2D_ARRAY.getRawClass(); + // THEN + then(result).isEqualTo(byte[][].class); + } + + @Test + void createAssert() { + // WHEN + Byte2DArrayAssert result = BYTE_2D_ARRAY.createAssert(actual); + // THEN + result.hasDimensions(2, 2); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + Byte2DArrayAssert result = BYTE_2D_ARRAY.createAssert(valueProvider); + // THEN + result.hasDimensions(2, 2); + verify(valueProvider).apply(byte[][].class); + } + + } + + @Nested + class Character_Factory { + + private final Object actual = 'a'; + + @Test + void getRawClass() { + // WHEN + Class result = CHARACTER.getRawClass(); + // THEN + then(result).isEqualTo(Character.class); + } + + @Test + void createAssert() { + // WHEN + AbstractCharacterAssert result = CHARACTER.createAssert(actual); + // THEN + result.isLowerCase(); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + AbstractCharacterAssert result = CHARACTER.createAssert(valueProvider); + // THEN + result.isLowerCase(); + verify(valueProvider).apply(Character.class); + } + + } + + @Nested + class Char_Array_Factory { + + private final Object actual = new char[] { 'a', 'b' }; + + @Test + void getRawClass() { + // WHEN + Class result = CHAR_ARRAY.getRawClass(); + // THEN + then(result).isEqualTo(char[].class); + } + + @Test + void createAssert() { + // WHEN + AbstractCharArrayAssert result = CHAR_ARRAY.createAssert(actual); + // THEN + result.doesNotHaveDuplicates(); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + AbstractCharArrayAssert result = CHAR_ARRAY.createAssert(valueProvider); + // THEN + result.doesNotHaveDuplicates(); + verify(valueProvider).apply(char[].class); + } + + } + + @Nested + class Char_2D_Array_Factory { + + private final Object actual = new char[][] { { 'a', 'b' }, { 'c', 'd' } }; + + @Test + void getRawClass() { + // WHEN + Class result = CHAR_2D_ARRAY.getRawClass(); + // THEN + then(result).isEqualTo(char[][].class); + } + + @Test + void createAssert() { + // WHEN + Char2DArrayAssert result = CHAR_2D_ARRAY.createAssert(actual); + // THEN + result.hasDimensions(2, 2); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + Char2DArrayAssert result = CHAR_2D_ARRAY.createAssert(valueProvider); + // THEN + result.hasDimensions(2, 2); + verify(valueProvider).apply(char[][].class); + } + + } + + @Nested + class Class_Factory { + + private final Object actual = Function.class; + + @Test + void getRawClass() { + // WHEN + Class result = CLASS.getRawClass(); + // THEN + then(result).isEqualTo(Class.class); + } + + @Test + void createAssert() { + // WHEN + ClassAssert result = CLASS.createAssert(actual); + // THEN + result.hasAnnotations(FunctionalInterface.class); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + ClassAssert result = CLASS.createAssert(valueProvider); + // THEN + result.hasAnnotations(FunctionalInterface.class); + verify(valueProvider).apply(Class.class); + } + + } + + @Nested + class Double_Factory { + + private final Object actual = 0.0; + + @Test + void getRawClass() { + // WHEN + Class result = DOUBLE.getRawClass(); + // THEN + then(result).isEqualTo(Double.class); + } + + @Test + void createAssert() { + // WHEN + AbstractDoubleAssert result = DOUBLE.createAssert(actual); + // THEN + result.isZero(); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + AbstractDoubleAssert result = DOUBLE.createAssert(valueProvider); + // THEN + result.isZero(); + verify(valueProvider).apply(Double.class); + } + + } + + @Nested + class Double_Array_Factory { + + private final Object actual = new double[] { 0.0, 1.0 }; + + @Test + void getRawClass() { + // WHEN + Class result = DOUBLE_ARRAY.getRawClass(); + // THEN + then(result).isEqualTo(double[].class); + } + + @Test + void createAssert() { + // WHEN + AbstractDoubleArrayAssert result = DOUBLE_ARRAY.createAssert(actual); + // THEN + result.containsExactly(0.0, 1.0); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + AbstractDoubleArrayAssert result = DOUBLE_ARRAY.createAssert(valueProvider); + // THEN + result.containsExactly(0.0, 1.0); + verify(valueProvider).apply(double[].class); + } + + } + + @Nested + class Double_2D_Array_Factory { + + private final Object actual = new double[][] { { 0.0, 1.0 }, { 2.0, 3.0 } }; + + @Test + void getRawClass() { + // WHEN + Class result = DOUBLE_2D_ARRAY.getRawClass(); + // THEN + then(result).isEqualTo(double[][].class); + } + + @Test + void createAssert() { + // WHEN + Double2DArrayAssert result = DOUBLE_2D_ARRAY.createAssert(actual); + // THEN + result.hasDimensions(2, 2); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + Double2DArrayAssert result = DOUBLE_2D_ARRAY.createAssert(valueProvider); + // THEN + result.hasDimensions(2, 2); + verify(valueProvider).apply(double[][].class); + } + + } + + @Nested + class File_Factory { + + private final Object actual = new File("non-existing-file"); + + @Test + void getRawClass() { + // WHEN + Class result = FILE.getRawClass(); + // THEN + then(result).isEqualTo(File.class); + } + + @Test + void createAssert() { + // WHEN + AbstractFileAssert result = FILE.createAssert(actual); + // THEN + result.doesNotExist(); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + AbstractFileAssert result = FILE.createAssert(valueProvider); + // THEN + result.doesNotExist(); + verify(valueProvider).apply(File.class); + } + + } + + @Nested + class Future_Factory { + + private final Object actual = mock(Future.class); + + @Test + void getRawClass() { + // WHEN + Class result = FUTURE.getRawClass(); + // THEN + then(result).isEqualTo(Future.class); + } + + @Test + void createAssert() { + // WHEN + FutureAssert result = FUTURE.createAssert(actual); + // THEN + result.isNotDone(); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + FutureAssert result = FUTURE.createAssert(valueProvider); + // THEN + result.isNotDone(); + verify(valueProvider).apply(parameterizedType(Future.class, Object.class)); + } + + } + + @Nested + class Future_Typed_Factory { + + private final Object actual = mock(Future.class); + + @Test + void getRawClass() { + // WHEN + Class result = future(String.class).getRawClass(); + // THEN + then(result).isEqualTo(Future.class); + } + + @Test + void createAssert() { + // WHEN + FutureAssert result = future(String.class).createAssert(actual); + // THEN + result.isNotDone(); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + FutureAssert result = future(String.class).createAssert(valueProvider); + // THEN + result.isNotDone(); + verify(valueProvider).apply(parameterizedType(Future.class, String.class)); + } + + } + + @Nested + class InputStream_Factory { + + private final Object actual = new ByteArrayInputStream("stream".getBytes()); + + @Test + void getRawClass() { + // WHEN + Class result = INPUT_STREAM.getRawClass(); + // THEN + then(result).isEqualTo(InputStream.class); + } + + @Test + void createAssert() { + // WHEN + AbstractInputStreamAssert result = INPUT_STREAM.createAssert(actual); + // THEN + result.hasContent("stream"); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + AbstractInputStreamAssert result = INPUT_STREAM.createAssert(valueProvider); + // THEN + result.hasContent("stream"); + verify(valueProvider).apply(InputStream.class); + } + + } + + @Nested + class Float_Factory { + + private final Object actual = 0.0f; + + @Test + void getRawClass() { + // WHEN + Class result = FLOAT.getRawClass(); + // THEN + then(result).isEqualTo(Float.class); + } + + @Test + void createAssert() { + // WHEN + AbstractFloatAssert result = FLOAT.createAssert(actual); + // THEN + result.isZero(); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + AbstractFloatAssert result = FLOAT.createAssert(valueProvider); + // THEN + result.isZero(); + verify(valueProvider).apply(Float.class); + } + + } + + @Nested + class Float_Array_Factory { + + private final Object actual = new float[] { 0.0f, 1.0f }; + + @Test + void getRawClass() { + // WHEN + Class result = FLOAT_ARRAY.getRawClass(); + // THEN + then(result).isEqualTo(float[].class); + } + + @Test + void createAssert() { + // WHEN + AbstractFloatArrayAssert result = FLOAT_ARRAY.createAssert(actual); + // THEN + result.containsExactly(0.0f, 1.0f); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + AbstractFloatArrayAssert result = FLOAT_ARRAY.createAssert(valueProvider); + // THEN + result.containsExactly(0.0f, 1.0f); + verify(valueProvider).apply(float[].class); + } + + } + + @Nested + class Float_2D_Array_Factory { + + private final Object actual = new float[][] { { 0.0f, 1.0f }, { 2.0f, 3.0f } }; + + @Test + void getRawClass() { + // WHEN + Class result = FLOAT_2D_ARRAY.getRawClass(); + // THEN + then(result).isEqualTo(float[][].class); + } + + @Test + void createAssert() { + // WHEN + Float2DArrayAssert result = FLOAT_2D_ARRAY.createAssert(actual); + // THEN + result.hasDimensions(2, 2); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + Float2DArrayAssert result = FLOAT_2D_ARRAY.createAssert(valueProvider); + // THEN + result.hasDimensions(2, 2); + verify(valueProvider).apply(float[][].class); + } + + } + + @Nested + class Integer_Factory { + + private final Object actual = 0; + + @Test + void getRawClass() { + // WHEN + Class result = INTEGER.getRawClass(); + // THEN + then(result).isEqualTo(Integer.class); + } + + @Test + void createAssert() { + // WHEN + AbstractIntegerAssert result = INTEGER.createAssert(actual); + // THEN + result.isZero(); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + AbstractIntegerAssert result = INTEGER.createAssert(valueProvider); + // THEN + result.isZero(); + verify(valueProvider).apply(Integer.class); + } + + } + + @Nested + class Int_Array_Factory { + + private final Object actual = new int[] { 0, 1 }; + + @Test + void getRawClass() { + // WHEN + Class result = INT_ARRAY.getRawClass(); + // THEN + then(result).isEqualTo(int[].class); + } + + @Test + void createAssert() { + // WHEN + AbstractIntArrayAssert result = INT_ARRAY.createAssert(actual); + // THEN + result.containsExactly(0, 1); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + AbstractIntArrayAssert result = INT_ARRAY.createAssert(valueProvider); + // THEN + result.containsExactly(0, 1); + verify(valueProvider).apply(int[].class); + } + + } + + @Nested + class Int_2D_Array_Factory { + + private final Object actual = new int[][] { { 0, 1 }, { 2, 3 } }; + + @Test + void getRawClass() { + // WHEN + Class result = INT_2D_ARRAY.getRawClass(); + // THEN + then(result).isEqualTo(int[][].class); + } + + @Test + void createAssert() { + // WHEN + Int2DArrayAssert result = INT_2D_ARRAY.createAssert(actual); + // THEN + result.hasDimensions(2, 2); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + Int2DArrayAssert result = INT_2D_ARRAY.createAssert(valueProvider); + // THEN + result.hasDimensions(2, 2); + verify(valueProvider).apply(int[][].class); + } + + } + + @Nested + class Long_Factory { + + private final Object actual = 0L; + + @Test + void getRawClass() { + // WHEN + Class result = LONG.getRawClass(); + // THEN + then(result).isEqualTo(Long.class); + } + + @Test + void createAssert() { + // WHEN + AbstractLongAssert result = LONG.createAssert(actual); + // THEN + result.isZero(); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + AbstractLongAssert result = LONG.createAssert(valueProvider); + // THEN + result.isZero(); + verify(valueProvider).apply(Long.class); + } + + } + + @Nested + class Long_Array_Factory { + + private final Object actual = new long[] { 0L, 1L }; + + @Test + void getRawClass() { + // WHEN + Class result = LONG_ARRAY.getRawClass(); + // THEN + then(result).isEqualTo(long[].class); + } + + @Test + void createAssert() { + // WHEN + AbstractLongArrayAssert result = LONG_ARRAY.createAssert(actual); + // THEN + result.containsExactly(0L, 1L); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + AbstractLongArrayAssert result = LONG_ARRAY.createAssert(valueProvider); + // THEN + result.containsExactly(0L, 1L); + verify(valueProvider).apply(long[].class); + } + + } + + @Nested + class Long_2D_Array_Factory { + + private final Object actual = new long[][] { { 0L, 1L }, { 2L, 3L } }; + + @Test + void getRawClass() { + // WHEN + Class result = LONG_2D_ARRAY.getRawClass(); + // THEN + then(result).isEqualTo(long[][].class); + } + + @Test + void createAssert() { + // WHEN + Long2DArrayAssert result = LONG_2D_ARRAY.createAssert(actual); + // THEN + result.hasDimensions(2, 2); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + Long2DArrayAssert result = LONG_2D_ARRAY.createAssert(valueProvider); + // THEN + result.hasDimensions(2, 2); + verify(valueProvider).apply(long[][].class); + } + + } + + @Nested + class Type_Factory { + + private final Object actual = "string"; + + @Test + void getRawClass() { + // WHEN + Class result = type(String.class).getRawClass(); + // THEN + then(result).isEqualTo(String.class); + } + + @Test + void createAssert() { + // WHEN + ObjectAssert result = type(String.class).createAssert(actual); + // THEN + result.extracting(String::isEmpty).isEqualTo(false); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + ObjectAssert result = type(String.class).createAssert(valueProvider); + // THEN + result.extracting(String::isEmpty).isEqualTo(false); + verify(valueProvider).apply(String.class); + } + + } + + @Nested + class Array_Factory { + + private final Object actual = new Object[] { 0, "" }; + + @Test + void getRawClass() { + // WHEN + Class result = ARRAY.getRawClass(); + // THEN + then(result).isEqualTo(Object[].class); + } + + @Test + void createAssert() { + // WHEN + ObjectArrayAssert result = ARRAY.createAssert(actual); + // THEN + result.containsExactly(0, ""); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + ObjectArrayAssert result = ARRAY.createAssert(valueProvider); + // THEN + result.containsExactly(0, ""); + verify(valueProvider).apply(Object[].class); + } + + } + + @Nested + class Array_Typed_Factory { + + private final Object actual = new Integer[] { 0, 1 }; + + @Test + void getRawClass() { + // WHEN + Class result = array(Integer[].class).getRawClass(); + // THEN + then(result).isEqualTo(Integer[].class); + } + + @Test + void createAssert() { + // WHEN + ObjectArrayAssert result = array(Integer[].class).createAssert(actual); + // THEN + result.containsExactly(0, 1); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + ObjectArrayAssert result = array(Integer[].class).createAssert(valueProvider); + // THEN + result.containsExactly(0, 1); + verify(valueProvider).apply(Integer[].class); + } + } - @Test - void predicate_factory_createAssert_with_ValueProvider_should_create_predicate_assertions() { - // GIVEN - ValueProvider> valueProvider = mockThatDelegatesTo(type -> Objects::isNull); - // WHEN - PredicateAssert result = PREDICATE.createAssert(valueProvider); - // THEN - result.accepts((Object) null); - verify(valueProvider).apply(parameterizedType(Predicate.class, Object.class)); + @Nested + class Array_2D_Factory { + + private final Object actual = new Object[][] { { 0, "" }, { 3.0, 'b' } }; + + @Test + void getRawClass() { + // WHEN + Class result = ARRAY_2D.getRawClass(); + // THEN + then(result).isEqualTo(Object[][].class); + } + + @Test + void createAssert() { + // WHEN + Object2DArrayAssert result = ARRAY_2D.createAssert(actual); + // THEN + result.hasDimensions(2, 2); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + Object2DArrayAssert result = ARRAY_2D.createAssert(valueProvider); + // THEN + result.hasDimensions(2, 2); + verify(valueProvider).apply(Object[][].class); + } + + } + + @Nested + class Array_2D_Typed_Factory { + + private final Object actual = new Integer[][] { { 0, 1 }, { 2, 3 } }; + + @Test + void getRawClass() { + // WHEN + Class result = array2D(Integer[][].class).getRawClass(); + // THEN + then(result).isEqualTo(Integer[][].class); + } + + @Test + void createAssert() { + // WHEN + Object2DArrayAssert result = array2D(Integer[][].class).createAssert(actual); + // THEN + result.hasDimensions(2, 2); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + Object2DArrayAssert result = array2D(Integer[][].class).createAssert(valueProvider); + // THEN + result.hasDimensions(2, 2); + verify(valueProvider).apply(Integer[][].class); + } + + } + + @Nested + class Short_Factory { + + private final Object actual = (short) 0; + + @Test + void getRawClass() { + // WHEN + Class result = SHORT.getRawClass(); + // THEN + then(result).isEqualTo(Short.class); + } + + @Test + void createAssert() { + // WHEN + AbstractShortAssert result = SHORT.createAssert(actual); + // THEN + result.isZero(); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + AbstractShortAssert result = SHORT.createAssert(valueProvider); + // THEN + result.isZero(); + verify(valueProvider).apply(Short.class); + } + + } + + @Nested + class Short_Array_Factory { + + private final Object actual = new short[] { 0, 1 }; + + @Test + void getRawClass() { + // WHEN + Class result = SHORT_ARRAY.getRawClass(); + // THEN + then(result).isEqualTo(short[].class); + } + + @Test + void createAssert() { + // WHEN + AbstractShortArrayAssert result = SHORT_ARRAY.createAssert(actual); + // THEN + result.containsExactly((short) 0, (short) 1); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + AbstractShortArrayAssert result = SHORT_ARRAY.createAssert(valueProvider); + // THEN + result.containsExactly((short) 0, (short) 1); + verify(valueProvider).apply(short[].class); + } + + } + + @Nested + class Short_2D_Array_Factory { + + private final Object actual = new short[][] { { 0, 1 }, { 2, 3 } }; + + @Test + void getRawClass() { + // WHEN + Class result = SHORT_2D_ARRAY.getRawClass(); + // THEN + then(result).isEqualTo(short[][].class); + } + + @Test + void createAssert() { + // WHEN + Short2DArrayAssert result = SHORT_2D_ARRAY.createAssert(actual); + // THEN + result.hasDimensions(2, 2); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + Short2DArrayAssert result = SHORT_2D_ARRAY.createAssert(valueProvider); + // THEN + result.hasDimensions(2, 2); + verify(valueProvider).apply(short[][].class); + } + + } + + @Nested + class Date_Factory { + + private final Object actual = new Date(); + + @Test + void getRawClass() { + // WHEN + Class result = DATE.getRawClass(); + // THEN + then(result).isEqualTo(Date.class); + } + + @Test + void createAssert() { + // WHEN + AbstractDateAssert result = DATE.createAssert(actual); + // THEN + result.isBeforeOrEqualTo(new Date()); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + AbstractDateAssert result = DATE.createAssert(valueProvider); + // THEN + result.isBeforeOrEqualTo(new Date()); + verify(valueProvider).apply(Date.class); + } + + } + + @Nested + class Temporal_Factory { + + private final Object actual = ZonedDateTime.now(); + + @Test + void getRawClass() { + // WHEN + Class result = TEMPORAL.getRawClass(); + // THEN + then(result).isEqualTo(Temporal.class); + } + + @Test + void createAssert() { + // WHEN + TemporalAssert result = TEMPORAL.createAssert(actual); + // THEN + result.isCloseTo(ZonedDateTime.now(), within(10, SECONDS)); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + TemporalAssert result = TEMPORAL.createAssert(valueProvider); + // THEN + result.isCloseTo(ZonedDateTime.now(), within(10, SECONDS)); + verify(valueProvider).apply(Temporal.class); + } + + } + + @Nested + class ZonedDateTime_Factory { + + private final Object actual = ZonedDateTime.now(); + + @Test + void getRawClass() { + // WHEN + Class result = ZONED_DATE_TIME.getRawClass(); + // THEN + then(result).isEqualTo(ZonedDateTime.class); + } + + @Test + void createAssert() { + // WHEN + AbstractZonedDateTimeAssert result = ZONED_DATE_TIME.createAssert(actual); + // THEN + result.isBeforeOrEqualTo(ZonedDateTime.now()); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + AbstractZonedDateTimeAssert result = ZONED_DATE_TIME.createAssert(valueProvider); + // THEN + result.isBeforeOrEqualTo(ZonedDateTime.now()); + verify(valueProvider).apply(ZonedDateTime.class); + } + + } + + @Nested + class LocalDateTime_Factory { + + private final Object actual = LocalDateTime.now(); + + @Test + void getRawClass() { + // WHEN + Class result = LOCAL_DATE_TIME.getRawClass(); + // THEN + then(result).isEqualTo(LocalDateTime.class); + } + + @Test + void createAssert() { + // WHEN + AbstractLocalDateTimeAssert result = LOCAL_DATE_TIME.createAssert(actual); + // THEN + result.isBeforeOrEqualTo(LocalDateTime.now()); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + AbstractLocalDateTimeAssert result = LOCAL_DATE_TIME.createAssert(valueProvider); + // THEN + result.isBeforeOrEqualTo(LocalDateTime.now()); + verify(valueProvider).apply(LocalDateTime.class); + } + + } + + @Nested + class OffsetDateTime_Factory { + + private final Object actual = OffsetDateTime.now(); + + @Test + void getRawClass() { + // WHEN + Class result = OFFSET_DATE_TIME.getRawClass(); + // THEN + then(result).isEqualTo(OffsetDateTime.class); + } + + @Test + void createAssert() { + // WHEN + AbstractOffsetDateTimeAssert result = OFFSET_DATE_TIME.createAssert(actual); + // THEN + result.isBeforeOrEqualTo(OffsetDateTime.now()); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + AbstractOffsetDateTimeAssert result = OFFSET_DATE_TIME.createAssert(valueProvider); + // THEN + result.isBeforeOrEqualTo(OffsetDateTime.now()); + verify(valueProvider).apply(OffsetDateTime.class); + } + + } + + @Nested + class OffsetTime_Factory { + + private final Object actual = OffsetTime.now(); + + @Test + void getRawClass() { + // WHEN + Class result = OFFSET_TIME.getRawClass(); + // THEN + then(result).isEqualTo(OffsetTime.class); + } + + @Test + void createAssert() { + // WHEN + AbstractOffsetTimeAssert result = OFFSET_TIME.createAssert(actual); + // THEN + result.isBeforeOrEqualTo(OffsetTime.now()); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + AbstractOffsetTimeAssert result = OFFSET_TIME.createAssert(valueProvider); + // THEN + result.isBeforeOrEqualTo(OffsetTime.now()); + verify(valueProvider).apply(OffsetTime.class); + } + + } + + @Nested + class LocalTime_Factory { + + private final Object actual = LocalTime.now(); + + @Test + void getRawClass() { + // WHEN + Class result = LOCAL_TIME.getRawClass(); + // THEN + then(result).isEqualTo(LocalTime.class); + } + + @Test + void createAssert() { + // WHEN + AbstractLocalTimeAssert result = LOCAL_TIME.createAssert(actual); + // THEN + result.isBeforeOrEqualTo(LocalTime.now()); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + AbstractLocalTimeAssert result = LOCAL_TIME.createAssert(valueProvider); + // THEN + result.isBeforeOrEqualTo(LocalTime.now()); + verify(valueProvider).apply(LocalTime.class); + } + + } + + @Nested + class LocalDate_Factory { + + private final Object actual = LocalDate.now(); + + @Test + void getRawClass() { + // WHEN + Class result = LOCAL_DATE.getRawClass(); + // THEN + then(result).isEqualTo(LocalDate.class); + } + + @Test + void createAssert() { + // WHEN + AbstractLocalDateAssert result = LOCAL_DATE.createAssert(actual); + // THEN + result.isBeforeOrEqualTo(LocalDate.now()); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + AbstractLocalDateAssert result = LOCAL_DATE.createAssert(valueProvider); + // THEN + result.isBeforeOrEqualTo(LocalDate.now()); + verify(valueProvider).apply(LocalDate.class); + } + } - @Test - void predicate_typed_factory_createAssert_should_create_predicate_typed_assertions() { - // GIVEN - Object value = (Predicate) Strings::isNullOrEmpty; - // WHEN - PredicateAssert result = predicate(String.class).createAssert(value); - // THEN - result.accepts(""); - } + @Nested + class YearMonth_Factory { - @Test - void predicate_typed_factory_createAssert_with_ValueProvider_should_create_predicate_typed_assertions() { - // GIVEN - ValueProvider> valueProvider = mockThatDelegatesTo(type -> Strings::isNullOrEmpty); - // WHEN - PredicateAssert result = predicate(String.class).createAssert(valueProvider); - // THEN - result.accepts(""); - verify(valueProvider).apply(parameterizedType(Predicate.class, String.class)); - } + private final Object actual = YearMonth.now(); - @Test - void int_predicate_factory_createAssert_should_create_int_predicate_assertions() { - // GIVEN - Object value = (IntPredicate) i -> i == 0; - // WHEN - IntPredicateAssert result = INT_PREDICATE.createAssert(value); - // THEN - result.accepts(0); - } + @Test + void getRawClass() { + // WHEN + Class result = YEAR_MONTH.getRawClass(); + // THEN + then(result).isEqualTo(YearMonth.class); + } - @Test - void int_predicate_factory_createAssert_with_ValueProvider_should_create_int_predicate_assertions() { - // GIVEN - ValueProvider valueProvider = mockThatDelegatesTo(type -> i -> i == 0); - // WHEN - IntPredicateAssert result = INT_PREDICATE.createAssert(valueProvider); - // THEN - result.accepts(0); - verify(valueProvider).apply(IntPredicate.class); - } + @Test + void createAssert() { + // WHEN + AbstractYearMonthAssert result = YEAR_MONTH.createAssert(actual); + // THEN + result.isBeforeOrEqualTo(YearMonth.now()); + } - @Test - void long_predicate_factory_createAssert_should_create_long_predicate_assertions() { - // GIVEN - Object value = (LongPredicate) l -> l == 0L; - // WHEN - LongPredicateAssert result = LONG_PREDICATE.createAssert(value); - // THEN - result.accepts(0L); - } + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + AbstractYearMonthAssert result = YEAR_MONTH.createAssert(valueProvider); + // THEN + result.isBeforeOrEqualTo(YearMonth.now()); + verify(valueProvider).apply(YearMonth.class); + } - @Test - void double_predicate_factory_createAssert_should_create_double_predicate_assertions() { - // GIVEN - Object value = (DoublePredicate) d -> d == 0.0; - // WHEN - DoublePredicateAssert result = DOUBLE_PREDICATE.createAssert(value); - // THEN - result.accepts(0.0); } - @Test - void completable_future_factory_createAssert_should_create_completable_future_assertions() { - // GIVEN - Object value = completedFuture("done"); - // WHEN - CompletableFutureAssert result = COMPLETABLE_FUTURE.createAssert(value); - // THEN - result.isDone(); - } + @Nested + class Instant_Factory { - @Test - void completable_future_typed_factory_createAssert_should_create_completable_future_typed_assertions() { - // GIVEN - Object value = completedFuture("done"); - // WHEN - CompletableFutureAssert result = completableFuture(String.class).createAssert(value); - // THEN - result.isDone(); - } + private final Object actual = Instant.now(); - @Test - void completion_stage_factory_createAssert_should_create_completable_future_assertions() { - // GIVEN - Object value = completedFuture("done"); - // WHEN - CompletableFutureAssert result = COMPLETION_STAGE.createAssert(value); - // THEN - result.isDone(); - } + @Test + void getRawClass() { + // WHEN + Class result = INSTANT.getRawClass(); + // THEN + then(result).isEqualTo(Instant.class); + } - @Test - void completion_stage_typed_factory_createAssert_should_create_completable_future_typed_assertions() { - // GIVEN - Object value = completedFuture("done"); - // WHEN - CompletableFutureAssert result = completionStage(String.class).createAssert(value); - // THEN - result.isDone(); - } + @Test + void createAssert() { + // WHEN + AbstractInstantAssert result = INSTANT.createAssert(actual); + // THEN + result.isBeforeOrEqualTo(Instant.now()); + } - @Test - void optional_factory_createAssert_should_create_optional_assertions() { - // GIVEN - Object value = Optional.of("something"); - // WHEN - OptionalAssert result = OPTIONAL.createAssert(value); - // THEN - result.isPresent(); - } + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + AbstractInstantAssert result = INSTANT.createAssert(valueProvider); + // THEN + result.isBeforeOrEqualTo(Instant.now()); + verify(valueProvider).apply(Instant.class); + } - @Test - void optional_typed_factory_createAssert_should_create_optional_typed_assertions() { - // GIVEN - Object value = Optional.of("something"); - // WHEN - OptionalAssert result = optional(String.class).createAssert(value); - // THEN - result.isPresent(); } - @Test - void optional_double_factory_createAssert_should_create_optional_double_assertions() { - // GIVEN - Object value = OptionalDouble.of(0.0); - // WHEN - OptionalDoubleAssert result = OPTIONAL_DOUBLE.createAssert(value); - // THEN - result.isPresent(); - } + @Nested + class Duration_Factory { - @Test - void optional_int_factory_createAssert_should_create_optional_int_assertions() { - // GIVEN - Object value = OptionalInt.of(0); - // WHEN - OptionalIntAssert result = OPTIONAL_INT.createAssert(value); - // THEN - result.isPresent(); - } + private final Object actual = Duration.ofHours(10); - @Test - void optional_long_factory_createAssert_should_create_optional_long_assertions() { - // GIVEN - Object value = OptionalLong.of(0L); - // WHEN - OptionalLongAssert result = OPTIONAL_LONG.createAssert(value); - // THEN - result.isPresent(); - } + @Test + void getRawClass() { + // WHEN + Class result = DURATION.getRawClass(); + // THEN + then(result).isEqualTo(Duration.class); + } - @Test - void matcher_factory_createAssert_should_create_matcher_assertions() { - // GIVEN - Object value = Pattern.compile("a*").matcher("aaa"); - // WHEN - MatcherAssert result = MATCHER.createAssert(value); - // THEN - result.matches(); - } + @Test + void createAssert() { + // WHEN + AbstractDurationAssert result = DURATION.createAssert(actual); + // THEN + result.hasHours(10); + } - @Test - void big_decimal_factory_createAssert_should_create_big_decimal_assertions() { - // GIVEN - Object value = BigDecimal.valueOf(0.0); - // WHEN - AbstractBigDecimalAssert result = BIG_DECIMAL.createAssert(value); - // THEN - result.isEqualTo("0.0"); - } + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + AbstractDurationAssert result = DURATION.createAssert(valueProvider); + // THEN + result.hasHours(10); + verify(valueProvider).apply(Duration.class); + } - @Test - void big_integer_factory_createAssert_should_create_big_integer_assertions() { - // GIVEN - Object value = BigInteger.valueOf(0L); - // WHEN - AbstractBigIntegerAssert result = BIG_INTEGER.createAssert(value); - // THEN - result.isEqualTo(0L); } - @Test - void uri_type_factory_createAssert_should_create_uri_assertions() { - // GIVEN - Object value = URI.create("http://localhost"); - // WHEN - AbstractUriAssert result = URI_TYPE.createAssert(value); - // THEN - result.hasHost("localhost"); - } + @Nested + class Period_Factory { - @Test - void url_type_factory_createAssert_should_create_url_assertions() throws MalformedURLException { - // GIVEN - Object value = new URL("http://localhost"); - // WHEN - AbstractUrlAssert result = URL_TYPE.createAssert(value); - // THEN - result.hasHost("localhost"); - } + private final Object actual = Period.ofYears(1); - @Test - void boolean_factory_createAssert_should_create_boolean_assertions() { - // GIVEN - Object value = true; - // WHEN - AbstractBooleanAssert result = BOOLEAN.createAssert(value); - // THEN - result.isTrue(); - } + @Test + void getRawClass() { + // WHEN + Class result = PERIOD.getRawClass(); + // THEN + then(result).isEqualTo(Period.class); + } - @Test - void boolean_array_factory_createAssert_should_create_boolean_array_assertions() { - // GIVEN - Object value = new boolean[] { true, false }; - // WHEN - AbstractBooleanArrayAssert result = BOOLEAN_ARRAY.createAssert(value); - // THEN - result.containsExactly(true, false); - } + @Test + void createAssert() { + // WHEN + AbstractPeriodAssert result = PERIOD.createAssert(actual); + // THEN + result.hasYears(1); + } - @Test - void boolean_2d_array_factory_createAssert_should_create_boolean_2d_array_assertions() { - // GIVEN - Object value = new boolean[][] { { true, false }, { false, true } }; - // WHEN - Boolean2DArrayAssert result = BOOLEAN_2D_ARRAY.createAssert(value); - // THEN - result.hasDimensions(2, 2); - } + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + AbstractPeriodAssert result = PERIOD.createAssert(valueProvider); + // THEN + result.hasYears(1); + verify(valueProvider).apply(Period.class); + } - @Test - void byte_factory_createAssert_should_create_byte_assertions() { - // GIVEN - Object value = (byte) 0; - // WHEN - AbstractByteAssert result = BYTE.createAssert(value); - // THEN - result.isEqualTo((byte) 0); } - @Test - void byte_array_factory_createAssert_should_create_byte_array_assertions() { - // GIVEN - Object value = new byte[] { 0, 1 }; - // WHEN - AbstractByteArrayAssert result = BYTE_ARRAY.createAssert(value); - // THEN - result.containsExactly(0, 1); - } + @Nested + class AtomicBoolean_Factory { - @Test - void byte_2d_array_factory_createAssert_should_create_byte_2d_array_assertions() { - // GIVEN - Object value = new byte[][] { { 0, 1 }, { 2, 3 } }; - // WHEN - Byte2DArrayAssert result = BYTE_2D_ARRAY.createAssert(value); - // THEN - result.hasDimensions(2, 2); - } + private final Object actual = new AtomicBoolean(); - @Test - void character_factory_createAssert_should_create_character_assertions() { - // GIVEN - Object value = 'a'; - // WHEN - AbstractCharacterAssert result = CHARACTER.createAssert(value); - // THEN - result.isLowerCase(); - } + @Test + void getRawClass() { + // WHEN + Class result = ATOMIC_BOOLEAN.getRawClass(); + // THEN + then(result).isEqualTo(AtomicBoolean.class); + } - @Test - void char_array_factory_createAssert_should_create_char_array_assertions() { - // GIVEN - Object value = new char[] { 'a', 'b' }; - // WHEN - AbstractCharArrayAssert result = CHAR_ARRAY.createAssert(value); - // THEN - result.doesNotHaveDuplicates(); - } + @Test + void createAssert() { + // WHEN + AtomicBooleanAssert result = ATOMIC_BOOLEAN.createAssert(actual); + // THEN + result.isFalse(); + } - @Test - void char_2d_array_factory_createAssert_should_create_char_2d_array_assertions() { - // GIVEN - Object value = new char[][] { { 'a', 'b' }, { 'c', 'd' } }; - // WHEN - Char2DArrayAssert result = CHAR_2D_ARRAY.createAssert(value); - // THEN - result.hasDimensions(2, 2); - } + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + AtomicBooleanAssert result = ATOMIC_BOOLEAN.createAssert(valueProvider); + // THEN + result.isFalse(); + verify(valueProvider).apply(AtomicBoolean.class); + } - @Test - void class_factory_createAssert_should_create_class_assertions() { - // GIVEN - Object value = Function.class; - // WHEN - ClassAssert result = CLASS.createAssert(value); - // THEN - result.hasAnnotations(FunctionalInterface.class); } - @Test - void double_factory_createAssert_should_create_double_assertions() { - // GIVEN - Object value = 0.0; - // WHEN - AbstractDoubleAssert result = DOUBLE.createAssert(value); - // THEN - result.isZero(); - } + @Nested + class AtomicInteger_Factory { - @Test - void double_array_factory_createAssert_should_create_double_array_assertions() { - // GIVEN - Object value = new double[] { 0.0, 1.0 }; - // WHEN - AbstractDoubleArrayAssert result = DOUBLE_ARRAY.createAssert(value); - // THEN - result.containsExactly(0.0, 1.0); - } + private final Object actual = new AtomicInteger(); - @Test - void double_2d_array_factory_createAssert_should_create_double_2d_array_assertions() { - // GIVEN - Object value = new double[][] { { 0.0, 1.0 }, { 2.0, 3.0 } }; - // WHEN - Double2DArrayAssert result = DOUBLE_2D_ARRAY.createAssert(value); - // THEN - result.hasDimensions(2, 2); - } + @Test + void getRawClass() { + // WHEN + Class result = ATOMIC_INTEGER.getRawClass(); + // THEN + then(result).isEqualTo(AtomicInteger.class); + } + + @Test + void createAssert() { + // WHEN + AtomicIntegerAssert result = ATOMIC_INTEGER.createAssert(actual); + // THEN + result.hasValue(0); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + AtomicIntegerAssert result = ATOMIC_INTEGER.createAssert(valueProvider); + // THEN + result.hasValue(0); + verify(valueProvider).apply(AtomicInteger.class); + } - @Test - void file_factory_createAssert_should_create_file_assertions() { - // GIVEN - Object value = new File("random-file-which-does-not-exist"); - // WHEN - AbstractFileAssert result = FILE.createAssert(value); - // THEN - result.doesNotExist(); } - @Test - void future_factory_createAssert_should_create_future_assertions() { - // GIVEN - Object value = mock(Future.class); - // WHEN - FutureAssert result = FUTURE.createAssert(value); - // THEN - result.isNotDone(); + @Nested + class AtomicIntegerArray_Factory { + + private final Object actual = new AtomicIntegerArray(new int[] { 0, 1 }); + + @Test + void getRawClass() { + // WHEN + Class result = ATOMIC_INTEGER_ARRAY.getRawClass(); + // THEN + then(result).isEqualTo(AtomicIntegerArray.class); + } + + @Test + void createAssert() { + // WHEN + AtomicIntegerArrayAssert result = ATOMIC_INTEGER_ARRAY.createAssert(actual); + // THEN + result.containsExactly(0, 1); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + AtomicIntegerArrayAssert result = ATOMIC_INTEGER_ARRAY.createAssert(valueProvider); + // THEN + result.containsExactly(0, 1); + verify(valueProvider).apply(AtomicIntegerArray.class); + } + } - @Test - void future_typed_factory_createAssert_should_create_future_typed_assertions() { - // GIVEN - Object value = mock(Future.class); - // WHEN - FutureAssert result = future(String.class).createAssert(value); - // THEN - result.isNotDone(); + @Nested + class AtomicIntegerFieldUpdater_Factory { + + private final Object actual = AtomicIntegerFieldUpdater.newUpdater(VolatileFieldContainer.class, "intField"); + + @Test + void getRawClass() { + // WHEN + Class result = ATOMIC_INTEGER_FIELD_UPDATER.getRawClass(); + // THEN + then(result).isEqualTo(AtomicIntegerFieldUpdater.class); + } + + @Test + void createAssert() { + // WHEN + AtomicIntegerFieldUpdaterAssert result = ATOMIC_INTEGER_FIELD_UPDATER.createAssert(actual); + // THEN + result.hasValue(0, new VolatileFieldContainer()); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + AtomicIntegerFieldUpdaterAssert result = ATOMIC_INTEGER_FIELD_UPDATER.createAssert(valueProvider); + // THEN + result.hasValue(0, new VolatileFieldContainer()); + verify(valueProvider).apply(parameterizedType(AtomicIntegerFieldUpdater.class, Object.class)); + } + } - @Test - void input_stream_factory_createAssert_should_create_input_stream_assertions() { - // GIVEN - Object value = new ByteArrayInputStream("stream".getBytes()); - // WHEN - AbstractInputStreamAssert result = INPUT_STREAM.createAssert(value); - // THEN - result.hasContent("stream"); + @Nested + class AtomicIntegerFieldUpdater_Typed_Factory { + + private final Object actual = AtomicIntegerFieldUpdater.newUpdater(VolatileFieldContainer.class, "intField"); + + @Test + void getRawClass() { + // WHEN + Class result = atomicIntegerFieldUpdater(VolatileFieldContainer.class).getRawClass(); + // THEN + then(result).isEqualTo(AtomicIntegerFieldUpdater.class); + } + + @Test + void createAssert() { + // WHEN + AtomicIntegerFieldUpdaterAssert result = atomicIntegerFieldUpdater(VolatileFieldContainer.class).createAssert(actual); + // THEN + result.hasValue(0, new VolatileFieldContainer()); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + AtomicIntegerFieldUpdaterAssert result = atomicIntegerFieldUpdater(VolatileFieldContainer.class).createAssert(valueProvider); + // THEN + result.hasValue(0, new VolatileFieldContainer()); + verify(valueProvider).apply(parameterizedType(AtomicIntegerFieldUpdater.class, VolatileFieldContainer.class)); + } + } - @Test - void float_factory_createAssert_should_create_float_assertions() { - // GIVEN - Object value = 0.0f; - // WHEN - AbstractFloatAssert result = FLOAT.createAssert(value); - // THEN - result.isZero(); + @Nested + class LongAdder_Factory { + + private final Object actual = new LongAdder(); + + @Test + void getRawClass() { + // WHEN + Class result = LONG_ADDER.getRawClass(); + // THEN + then(result).isEqualTo(LongAdder.class); + } + + @Test + void createAssert() { + // WHEN + LongAdderAssert result = LONG_ADDER.createAssert(actual); + // THEN + result.hasValue(0L); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + LongAdderAssert result = LONG_ADDER.createAssert(valueProvider); + // THEN + result.hasValue(0L); + verify(valueProvider).apply(LongAdder.class); + } + } - @Test - void float_array_factory_createAssert_should_create_float_array_assertions() { - // GIVEN - Object value = new float[] { 0.0f, 1.0f }; - // WHEN - AbstractFloatArrayAssert result = FLOAT_ARRAY.createAssert(value); - // THEN - result.containsExactly(0.0f, 1.0f); + @Nested + class AtomicLong_Factory { + + private final Object actual = new AtomicLong(); + + @Test + void getRawClass() { + // WHEN + Class result = ATOMIC_LONG.getRawClass(); + // THEN + then(result).isEqualTo(AtomicLong.class); + } + + @Test + void createAssert() { + // WHEN + AtomicLongAssert result = ATOMIC_LONG.createAssert(actual); + // THEN + result.hasValue(0L); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + AtomicLongAssert result = ATOMIC_LONG.createAssert(valueProvider); + // THEN + result.hasValue(0L); + verify(valueProvider).apply(AtomicLong.class); + } + } - @Test - void float_2d_array_factory_createAssert_should_create_float_2d_array_assertions() { - // GIVEN - Object value = new float[][] { { 0.0f, 1.0f }, { 2.0f, 3.0f } }; - // WHEN - Float2DArrayAssert result = FLOAT_2D_ARRAY.createAssert(value); - // THEN - result.hasDimensions(2, 2); + @Nested + class AtomicLongArray_Factory { + + private final Object actual = new AtomicLongArray(new long[] { 0L, 1L }); + + @Test + void getRawClass() { + // WHEN + Class result = ATOMIC_LONG_ARRAY.getRawClass(); + // THEN + then(result).isEqualTo(AtomicLongArray.class); + } + + @Test + void createAssert() { + // WHEN + AtomicLongArrayAssert result = ATOMIC_LONG_ARRAY.createAssert(actual); + // THEN + result.containsExactly(0L, 1L); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + AtomicLongArrayAssert result = ATOMIC_LONG_ARRAY.createAssert(valueProvider); + // THEN + result.containsExactly(0L, 1L); + verify(valueProvider).apply(AtomicLongArray.class); + } + } - @Test - void integer_factory_createAssert_should_create_integer_assertions() { - // GIVEN - Object value = 0; - // WHEN - AbstractIntegerAssert result = INTEGER.createAssert(value); - // THEN - result.isZero(); - } + @Nested + class AtomicLongFieldUpdater_Factory { - @Test - void int_array_factory_createAssert_should_create_int_array_assertions() { - // GIVEN - Object value = new int[] { 0, 1 }; - // WHEN - AbstractIntArrayAssert result = INT_ARRAY.createAssert(value); - // THEN - result.containsExactly(0, 1); - } + private final Object actual = AtomicLongFieldUpdater.newUpdater(VolatileFieldContainer.class, "longField"); - @Test - void int_2d_array_factory_createAssert_should_create_int_2d_array_assertions() { - // GIVEN - Object value = new int[][] { { 0, 1 }, { 2, 3 } }; - // WHEN - Int2DArrayAssert result = INT_2D_ARRAY.createAssert(value); - // THEN - result.hasDimensions(2, 2); - } + @Test + void getRawClass() { + // WHEN + Class result = ATOMIC_LONG_FIELD_UPDATER.getRawClass(); + // THEN + then(result).isEqualTo(AtomicLongFieldUpdater.class); + } - @Test - void long_factory_createAssert_should_create_long_assertions() { - // GIVEN - Object value = 0L; - // WHEN - AbstractLongAssert result = LONG.createAssert(value); - // THEN - result.isZero(); - } + @Test + void createAssert() { + // WHEN + AtomicLongFieldUpdaterAssert result = ATOMIC_LONG_FIELD_UPDATER.createAssert(actual); + // THEN + result.hasValue(0L, new VolatileFieldContainer()); + } - @Test - void long_array_factory_createAssert_should_create_long_array_assertions() { - // GIVEN - Object value = new long[] { 0L, 1L }; - // WHEN - AbstractLongArrayAssert result = LONG_ARRAY.createAssert(value); - // THEN - result.containsExactly(0, 1); - } + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + AtomicLongFieldUpdaterAssert result = ATOMIC_LONG_FIELD_UPDATER.createAssert(valueProvider); + // THEN + result.hasValue(0L, new VolatileFieldContainer()); + verify(valueProvider).apply(parameterizedType(AtomicLongFieldUpdater.class, Object.class)); + } - @Test - void long_2d_array_factory_createAssert_should_create_long_2d_array_assertions() { - // GIVEN - Object value = new long[][] { { 0L, 1L }, { 2L, 3L } }; - // WHEN - Long2DArrayAssert result = LONG_2D_ARRAY.createAssert(value); - // THEN - result.hasDimensions(2, 2); } - @Test - void type_factory_createAssert_should_create_object_typed_assertions() { - // GIVEN - Object value = "string"; - // WHEN - ObjectAssert result = type(String.class).createAssert(value); - // THEN - result.extracting(String::isEmpty).isEqualTo(false); - } + @Nested + class AtomicLongFieldUpdater_Typed_Factory { - @Test - void array_factory_createAssert_should_create_array_assertions() { - // GIVEN - Object value = new Object[] { 0, "" }; - // WHEN - ObjectArrayAssert result = ARRAY.createAssert(value); - // THEN - result.containsExactly(0, ""); - } + private final Object actual = AtomicLongFieldUpdater.newUpdater(VolatileFieldContainer.class, "longField"); - @Test - void array_typed_factory_createAssert_should_create_array_typed_assertions() { - // GIVEN - Object value = new Integer[] { 0, 1 }; - // WHEN - ObjectArrayAssert result = array(Integer[].class).createAssert(value); - // THEN - result.containsExactly(0, 1); - } + @Test + void getRawClass() { + // WHEN + Class result = atomicLongFieldUpdater(VolatileFieldContainer.class).getRawClass(); + // THEN + then(result).isEqualTo(AtomicLongFieldUpdater.class); + } - @Test - void array_2d_factory_createAssert_should_create_2d_array_assertions() { - // GIVEN - Object value = new Object[][] { { 0, "" }, { 3.0, 'b' } }; - // WHEN - Object2DArrayAssert result = ARRAY_2D.createAssert(value); - // THEN - result.hasDimensions(2, 2); - } + @Test + void createAssert() { + // WHEN + AtomicLongFieldUpdaterAssert result = atomicLongFieldUpdater(VolatileFieldContainer.class).createAssert(actual); + // THEN + result.hasValue(0L, new VolatileFieldContainer()); + } - @Test - void array_2d_typed_factory_createAssert_should_create_2d_array_typed_assertions() { - // GIVEN - Object value = new Integer[][] { { 0, 1 }, { 2, 3 } }; - // WHEN - Object2DArrayAssert result = array2D(Integer[][].class).createAssert(value); - // THEN - result.hasDimensions(2, 2); - } + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + AtomicLongFieldUpdaterAssert result = atomicLongFieldUpdater(VolatileFieldContainer.class).createAssert(valueProvider); + // THEN + result.hasValue(0L, new VolatileFieldContainer()); + verify(valueProvider).apply(parameterizedType(AtomicLongFieldUpdater.class, VolatileFieldContainer.class)); + } - @Test - void short_factory_createAssert_should_create_short_assertions() { - // GIVEN - Object value = (short) 0; - // WHEN - AbstractShortAssert result = SHORT.createAssert(value); - // THEN - result.isZero(); } - @Test - void short_array_factory_createAssert_should_create_short_array_assertions() { - // GIVEN - Object value = new short[] { 0, 1 }; - // WHEN - AbstractShortArrayAssert result = SHORT_ARRAY.createAssert(value); - // THEN - result.containsExactly((short) 0, (short) 1); - } + @Nested + class AtomicReference_Factory { - @Test - void short_2d_array_factory_createAssert_should_create_short_2d_array_assertions() { - // GIVEN - Object value = new short[][] { { 0, 1 }, { 2, 3 } }; - // WHEN - Short2DArrayAssert result = SHORT_2D_ARRAY.createAssert(value); - // THEN - result.hasDimensions(2, 2); - } + private final Object actual = new AtomicReference<>(); - @Test - void date_factory_createAssert_should_create_date_assertions() { - // GIVEN - Object value = new Date(); - // WHEN - AbstractDateAssert result = DATE.createAssert(value); - // THEN - result.isBeforeOrEqualTo(new Date()); - } + @Test + void getRawClass() { + // WHEN + Class result = ATOMIC_REFERENCE.getRawClass(); + // THEN + then(result).isEqualTo(AtomicReference.class); + } - @Test - void temporal_factory_createAssert_should_create_temporal_assertions() { - // GIVEN - Object value = ZonedDateTime.now(); - // WHEN - TemporalAssert result = TEMPORAL.createAssert(value); - // THEN - result.isCloseTo(ZonedDateTime.now(), within(10, ChronoUnit.SECONDS)); - } + @Test + void createAssert() { + // WHEN + AtomicReferenceAssert result = ATOMIC_REFERENCE.createAssert(actual); + // THEN + result.hasValue(null); + } - @Test - void zoned_date_time_factory_createAssert_should_create_zoned_date_time_assertions() { - // GIVEN - Object value = ZonedDateTime.now(); - // WHEN - AbstractZonedDateTimeAssert result = ZONED_DATE_TIME.createAssert(value); - // THEN - result.isBeforeOrEqualTo(ZonedDateTime.now()); - } + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + AtomicReferenceAssert result = ATOMIC_REFERENCE.createAssert(valueProvider); + // THEN + result.hasValue(null); + verify(valueProvider).apply(parameterizedType(AtomicReference.class, Object.class)); + } - @Test - void local_date_time_factory_createAssert_should_create_local_date_time_assertions() { - // GIVEN - Object value = LocalDateTime.now(); - // WHEN - AbstractLocalDateTimeAssert result = LOCAL_DATE_TIME.createAssert(value); - // THEN - result.isBeforeOrEqualTo(LocalDateTime.now()); } - @Test - void offset_date_time_factory_createAssert_should_create_offset_date_time_assertions() { - // GIVEN - Object value = OffsetDateTime.now(); - // WHEN - AbstractOffsetDateTimeAssert result = OFFSET_DATE_TIME.createAssert(value); - // THEN - result.isBeforeOrEqualTo(OffsetDateTime.now()); - } + @Nested + class AtomicReference_Typed_Factory { - @Test - void offset_time_factory_createAssert_should_create_offset_time_assertions() { - // GIVEN - Object value = OffsetTime.now(); - // WHEN - AbstractOffsetTimeAssert result = OFFSET_TIME.createAssert(value); - // THEN - result.isBeforeOrEqualTo(OffsetTime.now()); - } + private final Object actual = new AtomicReference<>(0); - @Test - void local_time_factory_createAssert_should_create_local_time_assertions() { - // GIVEN - Object value = LocalTime.now(); - // WHEN - AbstractLocalTimeAssert result = LOCAL_TIME.createAssert(value); - // THEN - result.isBeforeOrEqualTo(LocalTime.now()); - } + @Test + void getRawClass() { + // WHEN + Class result = atomicReference(Integer.class).getRawClass(); + // THEN + then(result).isEqualTo(AtomicReference.class); + } - @Test - void local_date_factory_createAssert_should_create_local_date_assertions() { - // GIVEN - Object value = LocalDate.now(); - // WHEN - AbstractLocalDateAssert result = LOCAL_DATE.createAssert(value); - // THEN - result.isBeforeOrEqualTo(LocalDate.now()); - } + @Test + void createAssert() { + // WHEN + AtomicReferenceAssert result = atomicReference(Integer.class).createAssert(actual); + // THEN + result.hasValue(0); + } - @Test - void year_month_factory_createAssert_should_create_year_month_assertions() { - // GIVEN - Object value = YearMonth.now(); - // WHEN - AbstractYearMonthAssert result = YEAR_MONTH.createAssert(value); - // THEN - result.isBeforeOrEqualTo(YearMonth.now()); - } + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + AtomicReferenceAssert result = atomicReference(Integer.class).createAssert(valueProvider); + // THEN + result.hasValue(0); + verify(valueProvider).apply(parameterizedType(AtomicReference.class, Integer.class)); + } - @Test - void instant_factory_createAssert_should_create_instant_assertions() { - // GIVEN - Object value = Instant.now(); - // WHEN - AbstractInstantAssert result = INSTANT.createAssert(value); - // THEN - result.isBeforeOrEqualTo(Instant.now()); } - @Test - void duration_factory_createAssert_should_create_duration_assertions() { - // GIVEN - Object value = Duration.ofHours(10); - // WHEN - AbstractDurationAssert result = DURATION.createAssert(value); - // THEN - result.isPositive(); - } + @Nested + class AtomicReferenceArray_Factory { - @Test - void period_factory_createAssert_should_create_period_assertions() { - // GIVEN - Object value = Period.of(1, 1, 1); - // WHEN - AbstractPeriodAssert result = PERIOD.createAssert(value); - // THEN - result.hasDays(1); - } + private final Object actual = new AtomicReferenceArray<>(new Object[] { 0, "" }); - @Test - void atomic_boolean_factory_createAssert_should_create_atomic_boolean_assertions() { - // GIVEN - Object value = new AtomicBoolean(); - // WHEN - AtomicBooleanAssert result = ATOMIC_BOOLEAN.createAssert(value); - // THEN - result.isFalse(); - } + @Test + void getRawClass() { + // WHEN + Class result = ATOMIC_REFERENCE_ARRAY.getRawClass(); + // THEN + then(result).isEqualTo(AtomicReferenceArray.class); + } - @Test - void atomic_integer_factory_createAssert_should_create_atomic_integer_assertions() { - // GIVEN - Object value = new AtomicInteger(); - // WHEN - AtomicIntegerAssert result = ATOMIC_INTEGER.createAssert(value); - // THEN - result.hasValue(0); - } + @Test + void createAssert() { + // WHEN + AtomicReferenceArrayAssert result = ATOMIC_REFERENCE_ARRAY.createAssert(actual); + // THEN + result.containsExactly(0, ""); + } - @Test - void atomic_integer_array_factory_createAssert_should_create_atomic_integer_array_assertions() { - // GIVEN - Object value = new AtomicIntegerArray(new int[] { 0, 1 }); - // WHEN - AtomicIntegerArrayAssert result = ATOMIC_INTEGER_ARRAY.createAssert(value); - // THEN - result.containsExactly(0, 1); - } + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + AtomicReferenceArrayAssert result = ATOMIC_REFERENCE_ARRAY.createAssert(valueProvider); + // THEN + result.containsExactly(0, ""); + verify(valueProvider).apply(parameterizedType(AtomicReferenceArray.class, Object.class)); + } - @Test - void atomic_integer_field_updater_factory_createAssert_should_create_atomic_integer_field_updater_assertions() { - // GIVEN - Object value = AtomicIntegerFieldUpdater.newUpdater(VolatileFieldContainer.class, "intField"); - // WHEN - AtomicIntegerFieldUpdaterAssert result = ATOMIC_INTEGER_FIELD_UPDATER.createAssert(value); - // THEN - result.hasValue(0, new VolatileFieldContainer()); } - @Test - void atomic_integer_field_updater_typed_factory_createAssert_should_create_atomic_integer_field_updater_typed_assertions() { - // GIVEN - Object value = AtomicIntegerFieldUpdater.newUpdater(VolatileFieldContainer.class, "intField"); - // WHEN - AtomicIntegerFieldUpdaterAssert result = atomicIntegerFieldUpdater(VolatileFieldContainer.class).createAssert(value); - // THEN - result.hasValue(0, new VolatileFieldContainer()); - } + @Nested + class AtomicReferenceArray_Typed_Factory { - @Test - void long_adder_factory_createAssert_should_create_long_adder_assertions() { - // GIVEN - Object value = new LongAdder(); - // WHEN - LongAdderAssert result = LONG_ADDER.createAssert(value); - // THEN - result.hasValue(0L); - } + private final Object actual = new AtomicReferenceArray<>(new Integer[] { 0, 1 }); - @Test - void atomic_long_factory_createAssert_should_create_atomic_long_assertions() { - // GIVEN - Object value = new AtomicLong(); - // WHEN - AtomicLongAssert result = ATOMIC_LONG.createAssert(value); - // THEN - result.hasValue(0L); - } + @Test + void getRawClass() { + // WHEN + Class result = ATOMIC_REFERENCE_ARRAY.getRawClass(); + // THEN + then(result).isEqualTo(AtomicReferenceArray.class); + } - @Test - void atomic_long_array_factory_createAssert_should_create_atomic_long_array_assertions() { - // GIVEN - Object value = new AtomicLongArray(new long[] { 0L, 1L }); - // WHEN - AtomicLongArrayAssert result = ATOMIC_LONG_ARRAY.createAssert(value); - // THEN - result.containsExactly(0L, 1L); - } + @Test + void createAssert() { + // WHEN + AtomicReferenceArrayAssert result = atomicReferenceArray(Integer.class).createAssert(actual); + // THEN + result.containsExactly(0, 1); + } - @Test - void atomic_long_field_updater_factory_createAssert_should_create_atomic_long_field_updater_assertions() { - // GIVEN - Object value = AtomicLongFieldUpdater.newUpdater(VolatileFieldContainer.class, "longField"); - // WHEN - AtomicLongFieldUpdaterAssert result = ATOMIC_LONG_FIELD_UPDATER.createAssert(value); - // THEN - result.hasValue(0L, new VolatileFieldContainer()); - } + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + AtomicReferenceArrayAssert result = atomicReferenceArray(Integer.class).createAssert(valueProvider); + // THEN + result.containsExactly(0, 1); + verify(valueProvider).apply(parameterizedType(AtomicReferenceArray.class, Integer.class)); + } - @Test - void atomic_long_field_updater_typed_factory_createAssert_should_create_atomic_long_field_updater_typed_assertions() { - // GIVEN - Object value = AtomicLongFieldUpdater.newUpdater(VolatileFieldContainer.class, "longField"); - // WHEN - AtomicLongFieldUpdaterAssert result = atomicLongFieldUpdater(VolatileFieldContainer.class).createAssert(value); - // THEN - result.hasValue(0L, new VolatileFieldContainer()); } - @Test - void atomic_reference_factory_createAssert_should_create_atomic_reference_assertions() { - // GIVEN - Object value = new AtomicReference<>(); - // WHEN - AtomicReferenceAssert result = ATOMIC_REFERENCE.createAssert(value); - // THEN - result.hasValue(null); - } + @Nested + class AtomicReferenceFieldUpdater_Factory { - @Test - void atomic_reference_typed_factory_createAssert_should_create_atomic_reference_typed_assertions() { - // GIVEN - Object value = new AtomicReference<>(0); - // WHEN - AtomicReferenceAssert result = atomicReference(Integer.class).createAssert(value); - // THEN - result.hasValue(0); - } + private final Object actual = AtomicReferenceFieldUpdater.newUpdater(VolatileFieldContainer.class, String.class, + "stringField"); - @Test - void atomic_reference_array_factory_createAssert_should_create_atomic_reference_array_assertions() { - // GIVEN - Object value = new AtomicReferenceArray<>(new Object[] { 0, "" }); - // WHEN - AtomicReferenceArrayAssert result = ATOMIC_REFERENCE_ARRAY.createAssert(value); - // THEN - result.containsExactly(0, ""); - } + @Test + void getRawClass() { + // WHEN + Class result = ATOMIC_REFERENCE_FIELD_UPDATER.getRawClass(); + // THEN + then(result).isEqualTo(AtomicReferenceFieldUpdater.class); + } - @Test - void atomic_reference_array_typed_factory_createAssert_should_create_atomic_reference_array_typed_assertions() { - // GIVEN - Object value = new AtomicReferenceArray<>(new Integer[] { 0, 1 }); - // WHEN - AtomicReferenceArrayAssert result = atomicReferenceArray(Integer.class).createAssert(value); - // THEN - result.containsExactly(0, 1); - } + @Test + void createAssert() { + // WHEN + AtomicReferenceFieldUpdaterAssert result = ATOMIC_REFERENCE_FIELD_UPDATER.createAssert(actual); + // THEN + result.hasValue(null, new VolatileFieldContainer()); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + AtomicReferenceFieldUpdaterAssert result = ATOMIC_REFERENCE_FIELD_UPDATER.createAssert(valueProvider); + // THEN + result.hasValue(null, new VolatileFieldContainer()); + verify(valueProvider).apply(parameterizedType(AtomicReferenceFieldUpdater.class, Object.class, Object.class)); + } - @Test - void atomic_reference_field_updater_factory_createAssert_should_create_atomic_reference_field_updater_assertions() { - // GIVEN - Object value = AtomicReferenceFieldUpdater.newUpdater(VolatileFieldContainer.class, String.class, "stringField"); - // WHEN - AtomicReferenceFieldUpdaterAssert result = ATOMIC_REFERENCE_FIELD_UPDATER.createAssert(value); - // THEN - result.hasValue(null, new VolatileFieldContainer()); } - @Test - void atomic_reference_field_updater_typed_factory_createAssert_should_create_atomic_reference_field_updater_typed_assertions() { - // GIVEN - Object value = AtomicReferenceFieldUpdater.newUpdater(VolatileFieldContainer.class, String.class, "stringField"); - // WHEN - AtomicReferenceFieldUpdaterAssert result = atomicReferenceFieldUpdater(String.class, - VolatileFieldContainer.class).createAssert(value); - // THEN - result.hasValue(null, new VolatileFieldContainer()); + @Nested + class AtomicReferenceFieldUpdater_Typed_Factory { + + private final Object actual = AtomicReferenceFieldUpdater.newUpdater(VolatileFieldContainer.class, String.class, + "stringField"); + + @Test + void getRawClass() { + // WHEN + Class result = atomicReferenceFieldUpdater(String.class, + VolatileFieldContainer.class).getRawClass(); + // THEN + then(result).isEqualTo(AtomicReferenceFieldUpdater.class); + } + + @Test + void createAssert() { + // WHEN + AtomicReferenceFieldUpdaterAssert result = atomicReferenceFieldUpdater(String.class, + VolatileFieldContainer.class).createAssert(actual); + // THEN + result.hasValue(null, new VolatileFieldContainer()); + } + + @Test + void createAssert_with_ValueProvider() { + // GIVEN + ValueProvider valueProvider = mockThatDelegatesTo(type -> actual); + // WHEN + AtomicReferenceFieldUpdaterAssert result = atomicReferenceFieldUpdater(String.class, + VolatileFieldContainer.class).createAssert(valueProvider); + // THEN + result.hasValue(null, new VolatileFieldContainer()); + verify(valueProvider).apply(parameterizedType(AtomicReferenceFieldUpdater.class, String.class, + VolatileFieldContainer.class)); + } + } @Test @@ -1279,7 +3189,7 @@ void list_typed_factory_createAssert_with_ValueProvider_should_create_typed_list ListAssert result = list(String.class).createAssert(valueProvider); // THEN result.contains("Bart", "Lisa"); - verify(valueProvider).apply(parameterizedType(List.class, classes(String.class))); + verify(valueProvider).apply(parameterizedType(List.class, String.class)); } @Test @@ -1391,192 +3301,20 @@ private static class VolatileFieldContainer { } - @ParameterizedTest - @MethodSource({ - "nonParameterizedFactories", - "parameterizedFactories" - }) - void getRawClass(InstanceOfAssertFactory underTest, Class rawClass) { - // WHEN - Class result = underTest.getRawClass(); - // THEN - then(result).isEqualTo(rawClass); - } - - @ParameterizedTest - @MethodSource("nonParameterizedFactories") - void createAssert_with_ValueProvider_for_non_parameterized_factories(InstanceOfAssertFactory underTest, - Class rawClass) { - // GIVEN - ValueProvider valueProvider = mock(); - // WHEN - underTest.createAssert(valueProvider); - // THEN - verify(valueProvider).apply(rawClass); - } - - @ParameterizedTest - @MethodSource("nonParameterizedFactories") - void getType_for_non_parameterized_factories(InstanceOfAssertFactory underTest, Class rawClass) { - // WHEN - Type type = underTest.getType(); - // THEN - then(type).isEqualTo(rawClass); - } - - @ParameterizedTest - @MethodSource("parameterizedFactories") - void getType_for_parameterized_factories(InstanceOfAssertFactory underTest, Class rawClass, Class[] typeArguments) { - // WHEN - Type type = underTest.getType(); - // THEN - then(type).asInstanceOf(type(ParameterizedType.class)) - .returns(typeArguments, from(ParameterizedType::getActualTypeArguments)) - .returns(rawClass, from(ParameterizedType::getRawType)) - .returns(null, from(ParameterizedType::getOwnerType)); - } - - static Stream nonParameterizedFactories() { - return Stream.of(arguments(ARRAY, Object[].class), - arguments(ARRAY_2D, Object[][].class), - arguments(ATOMIC_BOOLEAN, AtomicBoolean.class), - arguments(ATOMIC_INTEGER, AtomicInteger.class), - arguments(ATOMIC_INTEGER_ARRAY, AtomicIntegerArray.class), - arguments(ATOMIC_LONG, AtomicLong.class), - arguments(ATOMIC_LONG_ARRAY, AtomicLongArray.class), - arguments(BIG_DECIMAL, BigDecimal.class), - arguments(BIG_INTEGER, BigInteger.class), - arguments(BOOLEAN, Boolean.class), - arguments(BOOLEAN_2D_ARRAY, boolean[][].class), - arguments(BOOLEAN_ARRAY, boolean[].class), - arguments(BYTE, Byte.class), - arguments(BYTE_2D_ARRAY, byte[][].class), - arguments(BYTE_ARRAY, byte[].class), - arguments(CHAR_2D_ARRAY, char[][].class), - arguments(CHAR_ARRAY, char[].class), - arguments(CHAR_SEQUENCE, CharSequence.class), - arguments(CHARACTER, Character.class), - arguments(CLASS, Class.class), - arguments(DATE, Date.class), - arguments(DOUBLE, Double.class), - arguments(DOUBLE_2D_ARRAY, double[][].class), - arguments(DOUBLE_ARRAY, double[].class), - arguments(DOUBLE_PREDICATE, DoublePredicate.class), - arguments(DOUBLE_STREAM, DoubleStream.class), - arguments(DURATION, Duration.class), - arguments(FILE, File.class), - arguments(FLOAT, Float.class), - arguments(FLOAT_2D_ARRAY, float[][].class), - arguments(FLOAT_ARRAY, float[].class), - arguments(INPUT_STREAM, InputStream.class), - arguments(INSTANT, Instant.class), - arguments(INT_2D_ARRAY, int[][].class), - arguments(INT_ARRAY, int[].class), - arguments(INT_PREDICATE, IntPredicate.class), - arguments(INT_STREAM, IntStream.class), - arguments(INTEGER, Integer.class), - arguments(LOCAL_DATE, LocalDate.class), - arguments(LOCAL_DATE_TIME, LocalDateTime.class), - arguments(LOCAL_TIME, LocalTime.class), - arguments(LONG, Long.class), - arguments(LONG_2D_ARRAY, long[][].class), - arguments(LONG_ADDER, LongAdder.class), - arguments(LONG_ARRAY, long[].class), - arguments(LONG_PREDICATE, LongPredicate.class), - arguments(LONG_STREAM, LongStream.class), - arguments(MATCHER, Matcher.class), - arguments(OFFSET_DATE_TIME, OffsetDateTime.class), - arguments(OFFSET_TIME, OffsetTime.class), - arguments(OPTIONAL_DOUBLE, OptionalDouble.class), - arguments(OPTIONAL_INT, OptionalInt.class), - arguments(OPTIONAL_LONG, OptionalLong.class), - arguments(PATH, Path.class), - arguments(PERIOD, Period.class), - arguments(SHORT, Short.class), - arguments(SHORT_2D_ARRAY, short[][].class), - arguments(SHORT_ARRAY, short[].class), - arguments(STRING, String.class), - arguments(STRING_BUFFER, StringBuffer.class), - arguments(STRING_BUILDER, StringBuilder.class), - arguments(TEMPORAL, Temporal.class), - arguments(THROWABLE, Throwable.class), - arguments(URI_TYPE, URI.class), - arguments(URL_TYPE, URL.class), - arguments(YEAR_MONTH, YearMonth.class), - arguments(ZONED_DATE_TIME, ZonedDateTime.class), - arguments(array(String[].class), String[].class), - arguments(array2D(String[][].class), String[][].class), - arguments(comparable(Integer.class), Integer.class), - arguments(throwable(RuntimeException.class), RuntimeException.class), - arguments(type(String.class), String.class)); - } - - static Stream parameterizedFactories() { - return Stream.of(arguments(ATOMIC_INTEGER_FIELD_UPDATER, AtomicIntegerFieldUpdater.class, classes(Object.class)), - arguments(ATOMIC_LONG_FIELD_UPDATER, AtomicLongFieldUpdater.class, classes(Object.class)), - arguments(ATOMIC_MARKABLE_REFERENCE, AtomicMarkableReference.class, classes(Object.class)), - arguments(ATOMIC_REFERENCE, AtomicReference.class, classes(Object.class)), - arguments(ATOMIC_REFERENCE_ARRAY, AtomicReferenceArray.class, classes(Object.class)), - arguments(ATOMIC_REFERENCE_FIELD_UPDATER, AtomicReferenceFieldUpdater.class, - classes(Object.class, Object.class)), - arguments(ATOMIC_STAMPED_REFERENCE, AtomicStampedReference.class, classes(Object.class)), - arguments(COLLECTION, Collection.class, classes(Object.class)), - arguments(COMPLETABLE_FUTURE, CompletableFuture.class, classes(Object.class)), - arguments(COMPLETION_STAGE, CompletionStage.class, classes(Object.class)), - arguments(FUTURE, Future.class, classes(Object.class)), - arguments(ITERABLE, Iterable.class, classes(Object.class)), - arguments(ITERATOR, Iterator.class, classes(Object.class)), - arguments(LIST, List.class, classes(Object.class)), - arguments(MAP, Map.class, classes(Object.class, Object.class)), - arguments(OPTIONAL, Optional.class, classes(Object.class)), - arguments(PREDICATE, Predicate.class, classes(Object.class)), - arguments(SET, Set.class, classes(Object.class)), - arguments(SPLITERATOR, Spliterator.class, classes(Object.class)), - arguments(STREAM, Stream.class, classes(Object.class)), - arguments(atomicIntegerFieldUpdater(VolatileFieldContainer.class), AtomicIntegerFieldUpdater.class, - classes(VolatileFieldContainer.class)), - arguments(atomicLongFieldUpdater(VolatileFieldContainer.class), AtomicLongFieldUpdater.class, - classes(VolatileFieldContainer.class)), - arguments(atomicMarkableReference(Integer.class), AtomicMarkableReference.class, classes(Integer.class)), - arguments(atomicReference(Integer.class), AtomicReference.class, classes(Integer.class)), - arguments(atomicReferenceArray(Integer.class), AtomicReferenceArray.class, classes(Integer.class)), - arguments(atomicReferenceFieldUpdater(String.class, VolatileFieldContainer.class), - AtomicReferenceFieldUpdater.class, - classes(String.class, VolatileFieldContainer.class)), - arguments(atomicStampedReference(Integer.class), AtomicStampedReference.class, classes(Integer.class)), - arguments(collection(String.class), Collection.class, classes(String.class)), - arguments(completableFuture(String.class), CompletableFuture.class, classes(String.class)), - arguments(completionStage(String.class), CompletionStage.class, classes(String.class)), - arguments(future(String.class), Future.class, classes(String.class)), - arguments(iterable(String.class), Iterable.class, classes(String.class)), - arguments(iterator(String.class), Iterator.class, classes(String.class)), - arguments(list(String.class), List.class, classes(String.class)), - arguments(map(String.class, String.class), Map.class, classes(String.class, String.class)), - arguments(optional(String.class), Optional.class, classes(String.class)), - arguments(predicate(String.class), Predicate.class, classes(String.class)), - arguments(set(String.class), Set.class, classes(String.class)), - arguments(spliterator(String.class), Spliterator.class, classes(String.class)), - arguments(stream(String.class), Stream.class, classes(String.class))); - } - - private static Class[] classes(Class... classes) { - return classes; - } - @SuppressWarnings("unchecked") @SafeVarargs private static T mockThatDelegatesTo(T delegate, T... reified) { if (reified.length > 0) { throw new IllegalArgumentException("Please don't pass any values here. Java will detect class automagically."); } - return mock((Class) reified.getClass().getComponentType(), AdditionalAnswers.delegatesTo(delegate)); + return mock((Class) reified.getClass().getComponentType(), delegatesTo(delegate)); } private static ParameterizedType parameterizedType(Class rawClass, Class... typeArguments) { return argThat(argument -> { - then(argument).returns(typeArguments, from(ParameterizedType::getActualTypeArguments)) - .returns(rawClass, from(ParameterizedType::getRawType)) - .returns(null, from(ParameterizedType::getOwnerType)); + assertThat(argument).returns(typeArguments, from(ParameterizedType::getActualTypeArguments)) + .returns(rawClass, from(ParameterizedType::getRawType)) + .returns(null, from(ParameterizedType::getOwnerType)); return true; }); }