diff --git a/assertj-core/src/main/java/org/assertj/core/api/AbstractBooleanAssert.java b/assertj-core/src/main/java/org/assertj/core/api/AbstractBooleanAssert.java index eed53e1e95..c90c5ca737 100644 --- a/assertj-core/src/main/java/org/assertj/core/api/AbstractBooleanAssert.java +++ b/assertj-core/src/main/java/org/assertj/core/api/AbstractBooleanAssert.java @@ -12,14 +12,14 @@ */ package org.assertj.core.api; +import static org.assertj.core.error.ShouldBeEqual.shouldBeEqual; import static org.assertj.core.error.ShouldBeFalse.shouldBeFalse; import static org.assertj.core.error.ShouldBeTrue.shouldBeTrue; +import static org.assertj.core.error.ShouldNotBeEqual.shouldNotBeEqual; import java.util.Comparator; -import org.assertj.core.internal.Booleans; import org.assertj.core.internal.Failures; -import org.assertj.core.util.VisibleForTesting; /** * Base class for all implementations of assertions for {@link Boolean}s. @@ -36,9 +36,6 @@ */ public abstract class AbstractBooleanAssert> extends AbstractAssert { - @VisibleForTesting - Booleans booleans = Booleans.instance(); - protected AbstractBooleanAssert(Boolean actual, Class selfType) { super(actual, selfType); } @@ -47,11 +44,11 @@ protected AbstractBooleanAssert(Boolean actual, Class selfType) { * Verifies that the actual value is {@code true}. *

* Example: - *

 // assertions will pass
+   * 
 // assertions succeed:
    * assertThat(true).isTrue();
    * assertThat(Boolean.TRUE).isTrue();
    *
-   * // assertions will fail
+   * // assertions fail:
    * assertThat(false).isTrue();
    * assertThat(Boolean.FALSE).isTrue();
* @@ -69,11 +66,11 @@ public SELF isTrue() { * Verifies that the actual value is {@code false}. *

* Example: - *

 // assertions will pass
+   * 
 // assertions succeed:
    * assertThat(false).isFalse();
    * assertThat(Boolean.FALSE).isFalse();
    *
-   * // assertions will fail
+   * // assertions fail:
    * assertThat(true).isFalse();
    * assertThat(Boolean.TRUE).isFalse();
* @@ -91,11 +88,11 @@ public SELF isFalse() { * Verifies that the actual value is equal to the given one. *

* Example: - *

 // assertions will pass
+   * 
 // assertions succeed:
    * assertThat(true).isEqualTo(true);
    * assertThat(Boolean.FALSE).isEqualTo(false);
    *
-   * // assertions will fail
+   * // assertions fail:
    * assertThat(true).isEqualTo(false);
    * assertThat(Boolean.TRUE).isEqualTo(false);
* @@ -105,7 +102,8 @@ public SELF isFalse() { * @throws AssertionError if the actual value is not equal to the given one. */ public SELF isEqualTo(boolean expected) { - booleans.assertEqual(info, actual, expected); + if (actual == null || actual != expected) + throw Failures.instance().failure(info, shouldBeEqual(actual, expected, info.representation())); return myself; } @@ -113,11 +111,11 @@ public SELF isEqualTo(boolean expected) { * Verifies that the actual value is not equal to the given one. *

* Example: - *

 // assertions will pass
+   * 
 // assertions succeed:
    * assertThat(true).isNotEqualTo(false);
    * assertThat(Boolean.FALSE).isNotEqualTo(true);
    *
-   * // assertions will fail
+   * // assertions fail:
    * assertThat(true).isNotEqualTo(true);
    * assertThat(Boolean.FALSE).isNotEqualTo(false);
* @@ -127,7 +125,7 @@ public SELF isEqualTo(boolean expected) { * @throws AssertionError if the actual value is equal to the given one. */ public SELF isNotEqualTo(boolean other) { - booleans.assertNotEqual(info, actual, other); + if (actual != null && actual == other) throwAssertionError(shouldNotBeEqual(actual, other)); return myself; } diff --git a/assertj-core/src/main/java/org/assertj/core/api/AtomicBooleanAssert.java b/assertj-core/src/main/java/org/assertj/core/api/AtomicBooleanAssert.java index bd450c521c..d9612e868d 100644 --- a/assertj-core/src/main/java/org/assertj/core/api/AtomicBooleanAssert.java +++ b/assertj-core/src/main/java/org/assertj/core/api/AtomicBooleanAssert.java @@ -17,14 +17,8 @@ import java.util.Comparator; import java.util.concurrent.atomic.AtomicBoolean; -import org.assertj.core.internal.Booleans; -import org.assertj.core.util.VisibleForTesting; - public class AtomicBooleanAssert extends AbstractAssert { - @VisibleForTesting - Booleans booleans = Booleans.instance(); - public AtomicBooleanAssert(AtomicBoolean actual) { super(actual, AtomicBooleanAssert.class); } diff --git a/assertj-core/src/main/java/org/assertj/core/internal/Booleans.java b/assertj-core/src/main/java/org/assertj/core/internal/Booleans.java deleted file mode 100644 index ca8e448bb9..0000000000 --- a/assertj-core/src/main/java/org/assertj/core/internal/Booleans.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * Copyright 2012-2024 the original author or authors. - */ -package org.assertj.core.internal; - -import static org.assertj.core.error.ShouldBeEqual.shouldBeEqual; -import static org.assertj.core.error.ShouldNotBeEqual.shouldNotBeEqual; - -import org.assertj.core.api.AssertionInfo; -import org.assertj.core.util.VisibleForTesting; - -/** - * Reusable assertions for {@link Boolean}s. - * - * @author Alex Ruiz - */ -public class Booleans { - - private static final Booleans INSTANCE = new Booleans(); - - /** - * Returns the singleton instance of this class. - * @return the singleton instance of this class. - */ - public static Booleans instance() { - return INSTANCE; - } - - @VisibleForTesting - Failures failures = Failures.instance(); - - @VisibleForTesting - Booleans() {} - - /** - * Asserts that two booleans are equal. - * @param info contains information about the assertion. - * @param actual the actual value. - * @param expected the expected value. - * @throws AssertionError if the actual value is not equal to the expected one. - */ - public void assertEqual(AssertionInfo info, Boolean actual, boolean expected) { - if (actual != null && actual == expected) return; - throw failures.failure(info, shouldBeEqual(actual, expected, info.representation())); - } - - /** - * Asserts that two longs are not equal. - * @param info contains information about the assertion. - * @param actual the actual value. - * @param other the value to compare the actual value to. - * @throws AssertionError if the actual value is equal to the other one. - */ - public void assertNotEqual(AssertionInfo info, Boolean actual, boolean other) { - if (actual == null || actual != other) return; - throw failures.failure(info, shouldNotBeEqual(actual, other)); - } -} diff --git a/assertj-core/src/test/java/org/assertj/core/api/BooleanAssertBaseTest.java b/assertj-core/src/test/java/org/assertj/core/api/BooleanAssertBaseTest.java deleted file mode 100644 index c92b205e40..0000000000 --- a/assertj-core/src/test/java/org/assertj/core/api/BooleanAssertBaseTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * Copyright 2012-2024 the original author or authors. - */ -package org.assertj.core.api; - -import static org.mockito.Mockito.mock; - -import org.assertj.core.internal.Booleans; - -/** - * Base class for {@link BooleanAssert} tests. - * - * @author Olivier Michallat - */ -public abstract class BooleanAssertBaseTest extends BaseTestTemplate { - protected Booleans booleans; - - @Override - protected BooleanAssert create_assertions() { - return new BooleanAssert(true); - } - - @Override - protected void inject_internal_objects() { - super.inject_internal_objects(); - booleans = mock(Booleans.class); - assertions.booleans = booleans; - } - - protected Booleans getBooleans(BooleanAssert someAssertions) { - return someAssertions.booleans; - } -} diff --git a/assertj-core/src/test/java/org/assertj/core/api/boolean_/BooleanAssert_isEqualTo_boolean_Test.java b/assertj-core/src/test/java/org/assertj/core/api/boolean_/BooleanAssert_isEqualTo_boolean_Test.java index 49e0a81894..6401c0a290 100644 --- a/assertj-core/src/test/java/org/assertj/core/api/boolean_/BooleanAssert_isEqualTo_boolean_Test.java +++ b/assertj-core/src/test/java/org/assertj/core/api/boolean_/BooleanAssert_isEqualTo_boolean_Test.java @@ -12,25 +12,51 @@ */ package org.assertj.core.api.boolean_; -import static org.mockito.Mockito.verify; +import static java.lang.Boolean.FALSE; +import static java.lang.Boolean.TRUE; +import static java.lang.String.format; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.BDDAssertions.then; +import static org.assertj.core.util.AssertionsUtil.expectAssertionError; -import org.assertj.core.api.BooleanAssert; -import org.assertj.core.api.BooleanAssertBaseTest; +import org.junit.jupiter.api.Test; -/** - * Tests for {@link BooleanAssert#isEqualTo(boolean)}. - * - * @author Alex Ruiz - */ -class BooleanAssert_isEqualTo_boolean_Test extends BooleanAssertBaseTest { +class BooleanAssert_isEqualTo_boolean_Test { + + @Test + void should_fail_if_actual_is_null_since_the_expected_argument_cannot_be_null() { + // GIVEN + Boolean actual = null; + // WHEN + AssertionError assertionError = expectAssertionError(() -> assertThat(actual).isEqualTo(true)); + // THEN + then(assertionError).hasMessage(format("%n" + + "expected: true%n" + + " but was: null")); + } - @Override - protected BooleanAssert invoke_api_method() { - return assertions.isEqualTo(false); + @Test + void should_pass_if_booleans_are_equal() { + assertThat(true).isEqualTo(true); + assertThat(true).isEqualTo(TRUE); + assertThat(TRUE).isEqualTo(true); + assertThat(TRUE).isEqualTo(TRUE); + assertThat(false).isEqualTo(false); + assertThat(false).isEqualTo(FALSE); + assertThat(FALSE).isEqualTo(false); + assertThat(FALSE).isEqualTo(FALSE); } - @Override - protected void verify_internal_effects() { - verify(booleans).assertEqual(getInfo(assertions), getActual(assertions), false); + @Test + void should_fail_if_booleans_are_not_equal() { + // GIVEN + boolean actual = false; + boolean expected = true; + // WHEN + AssertionError assertionError = expectAssertionError(() -> assertThat(actual).isEqualTo(expected)); + // THEN + then(assertionError).hasMessage(format("%n" + + "expected: true%n" + + " but was: false")); } } diff --git a/assertj-core/src/test/java/org/assertj/core/api/boolean_/BooleanAssert_isNotEqualTo_boolean_Test.java b/assertj-core/src/test/java/org/assertj/core/api/boolean_/BooleanAssert_isNotEqualTo_boolean_Test.java index 3eb107d270..6306e8af73 100644 --- a/assertj-core/src/test/java/org/assertj/core/api/boolean_/BooleanAssert_isNotEqualTo_boolean_Test.java +++ b/assertj-core/src/test/java/org/assertj/core/api/boolean_/BooleanAssert_isNotEqualTo_boolean_Test.java @@ -12,25 +12,46 @@ */ package org.assertj.core.api.boolean_; -import static org.mockito.Mockito.verify; +import static java.lang.Boolean.FALSE; +import static java.lang.Boolean.TRUE; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.BDDAssertions.then; +import static org.assertj.core.error.ShouldNotBeEqual.shouldNotBeEqual; +import static org.assertj.core.util.AssertionsUtil.expectAssertionError; -import org.assertj.core.api.BooleanAssert; -import org.assertj.core.api.BooleanAssertBaseTest; +import org.junit.jupiter.api.Test; -/** - * Tests for {@link BooleanAssert#isNotEqualTo(boolean)}. - * - * @author Alex Ruiz - */ -class BooleanAssert_isNotEqualTo_boolean_Test extends BooleanAssertBaseTest { +class BooleanAssert_isNotEqualTo_boolean_Test { + + @Test + void should_pass_if_actual_is_null_since_the_other_argument_cannot_be_null() { + Boolean actual = null; + assertThat(actual).isNotEqualTo(false); + assertThat(actual).isNotEqualTo(FALSE); + assertThat(actual).isNotEqualTo(true); + assertThat(actual).isNotEqualTo(TRUE); + } - @Override - protected BooleanAssert invoke_api_method() { - return assertions.isNotEqualTo(false); + @Test + void should_pass_if_booleans_are_not_equal() { + assertThat(true).isNotEqualTo(FALSE); + assertThat(true).isNotEqualTo(false); + assertThat(TRUE).isNotEqualTo(FALSE); + assertThat(TRUE).isNotEqualTo(false); + assertThat(false).isNotEqualTo(true); + assertThat(false).isNotEqualTo(TRUE); + assertThat(FALSE).isNotEqualTo(true); + assertThat(FALSE).isNotEqualTo(TRUE); } - @Override - protected void verify_internal_effects() { - verify(booleans).assertNotEqual(getInfo(assertions), getActual(assertions), false); + @Test + void should_fail_if_booleans_are_equal() { + // GIVEN + boolean actual = TRUE; + boolean expected = true; + // WHEN + AssertionError assertionError = expectAssertionError(() -> assertThat(actual).isNotEqualTo(expected)); + // THEN + then(assertionError).hasMessage(shouldNotBeEqual(actual, expected).create()); } } diff --git a/assertj-core/src/test/java/org/assertj/core/api/boolean_/BooleanAssert_usingComparator_Test.java b/assertj-core/src/test/java/org/assertj/core/api/boolean_/BooleanAssert_usingComparator_Test.java index 39bc772a8c..c7f20e22e1 100644 --- a/assertj-core/src/test/java/org/assertj/core/api/boolean_/BooleanAssert_usingComparator_Test.java +++ b/assertj-core/src/test/java/org/assertj/core/api/boolean_/BooleanAssert_usingComparator_Test.java @@ -12,47 +12,23 @@ */ package org.assertj.core.api.boolean_; +import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; import static org.assertj.core.test.AlwaysEqualComparator.alwaysEqual; import java.util.Comparator; -import org.assertj.core.api.BooleanAssert; -import org.assertj.core.api.BooleanAssertBaseTest; import org.junit.jupiter.api.Test; -/** - * Tests for {@link BooleanAssert#usingComparator(java.util.Comparator)}. - * - * @author Joel Costigliola - */ -class BooleanAssert_usingComparator_Test extends BooleanAssertBaseTest { - - private Comparator comparator = alwaysEqual(); +class BooleanAssert_usingComparator_Test { - @Override @Test @SuppressWarnings("deprecation") - public void should_have_internal_effects() { - assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(() -> - // in that, we don't care of the comparator, the point to check is that we can't use a comparator - assertions.usingComparator(comparator)); - } - - @Override - @Test - public void should_return_this() { - // Disabled since this method throws an exception - } - - @Override - protected BooleanAssert invoke_api_method() { - // Not used in this test - return null; - } - - @Override - protected void verify_internal_effects() { - // Not used in this test + void should_prevent_using_comparator_for_boolean_assertions() { + // GIVEN + // we don't care of the comparator, the point to check is that we can't use a comparator + Comparator comparator = alwaysEqual(); + // WHEN/THEN + assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(() -> assertThat(true).usingComparator(comparator)); } } diff --git a/assertj-core/src/test/java/org/assertj/core/api/boolean_/BooleanAssert_usingDefaultComparator_Test.java b/assertj-core/src/test/java/org/assertj/core/api/boolean_/BooleanAssert_usingDefaultComparator_Test.java index 2a327a4189..25409f2b9d 100644 --- a/assertj-core/src/test/java/org/assertj/core/api/boolean_/BooleanAssert_usingDefaultComparator_Test.java +++ b/assertj-core/src/test/java/org/assertj/core/api/boolean_/BooleanAssert_usingDefaultComparator_Test.java @@ -13,27 +13,20 @@ package org.assertj.core.api.boolean_; import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.BDDAssertions.then; import org.assertj.core.api.BooleanAssert; -import org.assertj.core.api.BooleanAssertBaseTest; import org.assertj.core.internal.Objects; +import org.junit.jupiter.api.Test; -/** - * Tests for {@link BooleanAssert#usingComparator(java.util.Comparator)} and - * {@link BooleanAssert#usingDefaultComparator()}. - * - * @author Joel Costigliola - */ -class BooleanAssert_usingDefaultComparator_Test extends BooleanAssertBaseTest { - - @Override - protected BooleanAssert invoke_api_method() { - return assertions.usingDefaultComparator(); - } +class BooleanAssert_usingDefaultComparator_Test { - @Override - protected void verify_internal_effects() { - assertThat(getObjects(assertions).getComparator()).isNull(); - assertThat(getObjects(assertions)).isSameAs(Objects.instance()); + @Test + void should_support_default_comparator() { + // WHEN + BooleanAssert assertions = (BooleanAssert) assertThat(true).usingDefaultComparator(); + // THEN + then(assertions).extracting("objects").isSameAs(Objects.instance()) + .extracting("comparator").isNull(); } } diff --git a/assertj-core/src/test/java/org/assertj/core/internal/BooleansBaseTest.java b/assertj-core/src/test/java/org/assertj/core/internal/BooleansBaseTest.java deleted file mode 100644 index 454aa47c5a..0000000000 --- a/assertj-core/src/test/java/org/assertj/core/internal/BooleansBaseTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * Copyright 2012-2024 the original author or authors. - */ -package org.assertj.core.internal; - -import static org.assertj.core.test.TestData.someInfo; -import static org.mockito.Mockito.spy; - -import org.assertj.core.api.AssertionInfo; -import org.junit.jupiter.api.BeforeEach; - -/** - * Base class for testing {@link Booleans}. - *

- * Is in org.assertj.core.internal package to be able to set {@link Booleans#failures} appropriately. - * - * @author Joel Costigliola - */ -public class BooleansBaseTest { - - protected static final AssertionInfo INFO = someInfo(); - - protected Failures failures; - protected Booleans booleans; - - @BeforeEach - public void setUp() { - failures = spy(new Failures()); - booleans = new Booleans(); - booleans.failures = failures; - } - -} diff --git a/assertj-core/src/test/java/org/assertj/core/internal/booleans/Booleans_assertEqual_Test.java b/assertj-core/src/test/java/org/assertj/core/internal/booleans/Booleans_assertEqual_Test.java deleted file mode 100644 index a34b4bba24..0000000000 --- a/assertj-core/src/test/java/org/assertj/core/internal/booleans/Booleans_assertEqual_Test.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * Copyright 2012-2024 the original author or authors. - */ -package org.assertj.core.internal.booleans; - -import static java.lang.Boolean.FALSE; -import static java.lang.Boolean.TRUE; -import static java.lang.String.format; -import static org.assertj.core.api.BDDAssertions.then; -import static org.assertj.core.error.ShouldBeEqual.shouldBeEqual; -import static org.assertj.core.util.AssertionsUtil.expectAssertionError; -import static org.mockito.Mockito.verify; - -import org.assertj.core.api.AssertionInfo; -import org.assertj.core.internal.Booleans; -import org.assertj.core.internal.BooleansBaseTest; -import org.junit.jupiter.api.Test; - -/** - * Tests for {@link Booleans#assertEqual(AssertionInfo, Boolean, boolean)}. - * - * @author Alex Ruiz - * @author Joel Costigliola - */ -class Booleans_assertEqual_Test extends BooleansBaseTest { - - @Test - void should_fail_if_actual_is_null_since_the_other_argument_cannot_be_null() { - // GIVEN - Boolean actual = null; - // WHEN - AssertionError assertionError = expectAssertionError(() -> booleans.assertEqual(INFO, actual, true)); - // THEN - then(assertionError).hasMessage(format("%n" + - "expected: true%n" + - " but was: null")); - } - - @Test - void should_pass_if_booleans_are_equal() { - booleans.assertEqual(INFO, true, true); - booleans.assertEqual(INFO, TRUE, true); - booleans.assertEqual(INFO, FALSE, false); - booleans.assertEqual(INFO, false, false); - } - - @Test - void should_fail_if_booleans_are_not_equal() { - // GIVEN - boolean actual = TRUE; - boolean expected = false; - // WHEN - expectAssertionError(() -> booleans.assertEqual(INFO, actual, expected)); - // THEN - verify(failures).failure(INFO, shouldBeEqual(actual, expected, INFO.representation())); - } -} diff --git a/assertj-core/src/test/java/org/assertj/core/internal/booleans/Booleans_assertNotEqual_Test.java b/assertj-core/src/test/java/org/assertj/core/internal/booleans/Booleans_assertNotEqual_Test.java deleted file mode 100644 index 0dcf1438a0..0000000000 --- a/assertj-core/src/test/java/org/assertj/core/internal/booleans/Booleans_assertNotEqual_Test.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * Copyright 2012-2024 the original author or authors. - */ -package org.assertj.core.internal.booleans; - -import static java.lang.Boolean.FALSE; -import static java.lang.Boolean.TRUE; -import static org.assertj.core.error.ShouldNotBeEqual.shouldNotBeEqual; -import static org.assertj.core.util.AssertionsUtil.expectAssertionError; -import static org.mockito.Mockito.verify; - -import org.assertj.core.api.AssertionInfo; -import org.assertj.core.internal.Booleans; -import org.assertj.core.internal.BooleansBaseTest; -import org.junit.jupiter.api.Test; - -/** - * Tests for {@link Booleans#assertNotEqual(AssertionInfo, Boolean, boolean)}. - * - * @author Alex Ruiz - * @author Joel Costigliola - */ -class Booleans_assertNotEqual_Test extends BooleansBaseTest { - - @Test - void should_pass_if_actual_is_null_since_the_other_argument_cannot_be_null() { - booleans.assertNotEqual(INFO, null, false); - booleans.assertNotEqual(INFO, null, FALSE); - booleans.assertNotEqual(INFO, null, true); - booleans.assertNotEqual(INFO, null, TRUE); - } - - @Test - void should_pass_if_booleans_are_not_equal() { - booleans.assertNotEqual(INFO, true, false); - booleans.assertNotEqual(INFO, true, FALSE); - booleans.assertNotEqual(INFO, TRUE, false); - booleans.assertNotEqual(INFO, TRUE, FALSE); - booleans.assertNotEqual(INFO, false, true); - booleans.assertNotEqual(INFO, false, TRUE); - booleans.assertNotEqual(INFO, FALSE, true); - booleans.assertNotEqual(INFO, FALSE, TRUE); - } - - @Test - void should_fail_if_booleans_are_equal() { - // GIVEN - boolean actual = TRUE; - boolean expected = true; - // WHEN - expectAssertionError(() -> booleans.assertNotEqual(INFO, actual, expected)); - // THEN - verify(failures).failure(INFO, shouldNotBeEqual(actual, expected)); - } -}