assertThat(T, Matcher<? super T>) Deprecated. Use org.hamcrest.MatcherAssert.assertThat()

This commit is contained in:
Alex Golub 2022-04-21 11:05:26 +03:00
parent 4bcb36ff41
commit 7d343f7674
1 changed files with 3 additions and 2 deletions

View File

@ -1,5 +1,6 @@
package com.baeldung.junit5vsjunit4assertions; package com.baeldung.junit5vsjunit4assertions;
import org.hamcrest.MatcherAssert;
import org.junit.Test; import org.junit.Test;
import java.util.Arrays; import java.util.Arrays;
@ -30,7 +31,7 @@ public class Junit4AssertionsUnitTest {
@Test @Test
public void whenAssertingArraysEquality_thenEqual() { public void whenAssertingArraysEquality_thenEqual() {
char[] expected = { 'J', 'u', 'n', 'i', 't' }; char[] expected = {'J', 'u', 'n', 'i', 't'};
char[] actual = "Junit".toCharArray(); char[] actual = "Junit".toCharArray();
assertArrayEquals(expected, actual); assertArrayEquals(expected, actual);
@ -95,7 +96,7 @@ public class Junit4AssertionsUnitTest {
@Test @Test
public void testAssertThatHasItems() { public void testAssertThatHasItems() {
assertThat(Arrays.asList("Java", "Kotlin", "Scala"), hasItems("Java", "Kotlin")); MatcherAssert.assertThat(Arrays.asList("Java", "Kotlin", "Scala"), hasItems("Java", "Kotlin"));
} }
} }