From 9de83345b54934cc4676ac1a83ddb999492bded8 Mon Sep 17 00:00:00 2001 From: Andrei Arlou Date: Wed, 26 Jun 2024 19:38:30 +0300 Subject: [PATCH] 4.x: Use Hamcrest assertions instead of JUnit in common/buffers (#1749) (#8883) --- .../io/helidon/common/buffers/AsciiTest.java | 29 +++++++++---------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/common/buffers/src/test/java/io/helidon/common/buffers/AsciiTest.java b/common/buffers/src/test/java/io/helidon/common/buffers/AsciiTest.java index 4ae366d9fa2..307d74efe69 100644 --- a/common/buffers/src/test/java/io/helidon/common/buffers/AsciiTest.java +++ b/common/buffers/src/test/java/io/helidon/common/buffers/AsciiTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,24 +19,21 @@ import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertTrue; class AsciiTest { @Test void testIsLowerCaseOne() { - assertFalse(Ascii.isLowerCase('{')); + assertThat(Ascii.isLowerCase('{'), is(false)); } @Test void testIsLowerCaseReturningTrue() { - assertTrue(Ascii.isLowerCase('o')); + assertThat(Ascii.isLowerCase('o'), is(true)); } @Test void testIsLowerCaseTwo() { - assertFalse(Ascii.isLowerCase('\"')); + assertThat(Ascii.isLowerCase('\"'), is(false)); } @Test @@ -52,32 +49,32 @@ void testToLowerCaseChar() { void testToLowerCaseTakingCharSequenceOne() { StringBuilder stringBuilder = new StringBuilder("uhho^s} b'jdwtym"); - assertEquals("uhho^s} b'jdwtym", Ascii.toLowerCase(stringBuilder)); + assertThat(Ascii.toLowerCase(stringBuilder), is("uhho^s} b'jdwtym")); } @Test void testToLowerCaseTakingCharSequenceTwo() { - assertEquals("uhho^s} b'jdwtym", Ascii.toLowerCase((CharSequence) "uHHO^S} b'jDwTYM")); + assertThat(Ascii.toLowerCase((CharSequence) "uHHO^S} b'jDwTYM"), is("uhho^s} b'jdwtym")); } @Test void testToLowerCaseTakingString() { - assertEquals("", Ascii.toLowerCase("")); + assertThat(Ascii.toLowerCase(""), is("")); } @Test void testIsUpperCaseOne() { - assertFalse(Ascii.isUpperCase('{')); + assertThat(Ascii.isUpperCase('{'), is(false)); } @Test void testIsUpperCaseReturningTrue() { - assertTrue(Ascii.isUpperCase('O')); + assertThat(Ascii.isUpperCase('O'), is(true)); } @Test void testIsUpperCaseTwo() { - assertFalse(Ascii.isUpperCase('\"')); + assertThat(Ascii.isUpperCase('\"'), is(false)); } @Test @@ -93,16 +90,16 @@ void testToUpperCaseChar() { void testToUpperCaseTakingCharSequenceOne() { StringBuilder stringBuilder = new StringBuilder("UhHO^S} B'JDWTYM"); - assertEquals("UHHO^S} B'JDWTYM", Ascii.toUpperCase(stringBuilder)); + assertThat(Ascii.toUpperCase(stringBuilder), is("UHHO^S} B'JDWTYM")); } @Test void testToUpperCaseTakingCharSequenceTwo() { - assertEquals("UHHO^S} B'JDWTYM", Ascii.toUpperCase((CharSequence) "uHHO^S} b'jDwTYM")); + assertThat(Ascii.toUpperCase((CharSequence) "uHHO^S} b'jDwTYM"), is("UHHO^S} B'JDWTYM")); } @Test void testToUpperCaseTakingString() { - assertEquals("UHHO^S} B'JDWTYM", Ascii.toUpperCase("uHHO^S} b'jDwTYM")); + assertThat(Ascii.toUpperCase("uHHO^S} b'jDwTYM"), is("UHHO^S} B'JDWTYM")); } } \ No newline at end of file