From 7d343f7674b2ed6ebc435ab533b0dddc8990a36d Mon Sep 17 00:00:00 2001 From: Alex Golub Date: Thu, 21 Apr 2022 11:05:26 +0300 Subject: [PATCH] assertThat(T, Matcher) Deprecated. Use org.hamcrest.MatcherAssert.assertThat() --- .../junit5vsjunit4assertions/Junit4AssertionsUnitTest.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/testing-modules/junit5-migration/src/test/java/com/baeldung/junit5vsjunit4assertions/Junit4AssertionsUnitTest.java b/testing-modules/junit5-migration/src/test/java/com/baeldung/junit5vsjunit4assertions/Junit4AssertionsUnitTest.java index 7e74c2dace..236a43036b 100644 --- a/testing-modules/junit5-migration/src/test/java/com/baeldung/junit5vsjunit4assertions/Junit4AssertionsUnitTest.java +++ b/testing-modules/junit5-migration/src/test/java/com/baeldung/junit5vsjunit4assertions/Junit4AssertionsUnitTest.java @@ -1,5 +1,6 @@ package com.baeldung.junit5vsjunit4assertions; +import org.hamcrest.MatcherAssert; import org.junit.Test; import java.util.Arrays; @@ -30,7 +31,7 @@ public class Junit4AssertionsUnitTest { @Test public void whenAssertingArraysEquality_thenEqual() { - char[] expected = { 'J', 'u', 'n', 'i', 't' }; + char[] expected = {'J', 'u', 'n', 'i', 't'}; char[] actual = "Junit".toCharArray(); assertArrayEquals(expected, actual); @@ -95,7 +96,7 @@ public class Junit4AssertionsUnitTest { @Test public void testAssertThatHasItems() { - assertThat(Arrays.asList("Java", "Kotlin", "Scala"), hasItems("Java", "Kotlin")); + MatcherAssert.assertThat(Arrays.asList("Java", "Kotlin", "Scala"), hasItems("Java", "Kotlin")); } }