From c1f5e966409e6954ad5b23d0f1e02b3a45251326 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Pav=C3=B3n?= <55098325+FranPavon@users.noreply.github.com> Date: Wed, 19 Oct 2022 18:05:13 -0300 Subject: [PATCH] Update StatePatternUnitTest.java assertThat is now deprecated. New solution is assertTrue. --- .../com/baeldung/state/StatePatternUnitTest.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/patterns-modules/design-patterns-behavioral/src/test/java/com/baeldung/state/StatePatternUnitTest.java b/patterns-modules/design-patterns-behavioral/src/test/java/com/baeldung/state/StatePatternUnitTest.java index 731974f92b..98babf0ccd 100644 --- a/patterns-modules/design-patterns-behavioral/src/test/java/com/baeldung/state/StatePatternUnitTest.java +++ b/patterns-modules/design-patterns-behavioral/src/test/java/com/baeldung/state/StatePatternUnitTest.java @@ -1,11 +1,9 @@ package com.baeldung.state; import com.baeldung.state.Package; +import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.junit.Assert.assertThat; -import static org.hamcrest.CoreMatchers.instanceOf; - -import org.junit.Test; +import org.junit.jupiter.api.Test; public class StatePatternUnitTest { @@ -13,13 +11,13 @@ public class StatePatternUnitTest { public void givenNewPackage_whenPackageReceived_thenStateReceived() { Package pkg = new Package(); - assertThat(pkg.getState(), instanceOf(OrderedState.class)); + assertTrue(pkg.getState() instanceof OrderedState); pkg.nextState(); - assertThat(pkg.getState(), instanceOf(DeliveredState.class)); + assertTrue(pkg.getState() instanceof DeliveredState); pkg.nextState(); - assertThat(pkg.getState(), instanceOf(ReceivedState.class)); + assertTrue(pkg.getState() instanceof ReceivedState); } @Test @@ -28,6 +26,6 @@ public class StatePatternUnitTest { pkg.setState(new DeliveredState()); pkg.previousState(); - assertThat(pkg.getState(), instanceOf(OrderedState.class)); + assertTrue(pkg.getState() instanceof OrderedState); } }