diff --git a/core-java-modules/core-java-string-conversions-3/src/test/java/com/baeldung/stringtolong/StringToLongPrimitiveOrLongObjectUnitTest.java b/core-java-modules/core-java-string-conversions-3/src/test/java/com/baeldung/stringtolong/StringToLongPrimitiveOrLongObjectUnitTest.java index 99f0adf792..e437529726 100644 --- a/core-java-modules/core-java-string-conversions-3/src/test/java/com/baeldung/stringtolong/StringToLongPrimitiveOrLongObjectUnitTest.java +++ b/core-java-modules/core-java-string-conversions-3/src/test/java/com/baeldung/stringtolong/StringToLongPrimitiveOrLongObjectUnitTest.java @@ -11,79 +11,79 @@ import com.google.common.primitives.Longs; public class StringToLongPrimitiveOrLongObjectUnitTest { @Test - public void givenString_whenUsingLongConstructor_thenObtainLongObject() { + void givenString_whenUsingLongConstructor_thenObtainLongObject() { Long l = new Long("2147483648"); assertThat(l).isEqualTo(2147483648L); } @Test - public void givenInvalidString_whenUsingLongConstructor_thenNumberFormatExceptionThrown() { + void givenInvalidString_whenUsingLongConstructor_thenNumberFormatExceptionThrown() { Assertions.assertThrows(NumberFormatException.class, () -> new Long("Invalid String")); } @Test - public void givenString_whenUsingLongValueOf_thenObtainLongObject() { + void givenString_whenUsingLongValueOf_thenObtainLongObject() { Long l = Long.valueOf("2147483648"); assertThat(l).isEqualTo(2147483648L); } @Test - public void givenInvalidString_whenUsingLongValueOf_thenNumberFormatExceptionThrown() { + void givenInvalidString_whenUsingLongValueOf_thenNumberFormatExceptionThrown() { Assertions.assertThrows(NumberFormatException.class, () -> Long.valueOf("Invalid String")); } @Test - public void givenString_whenUsingParseLong_thenObtainLongPrimitive() { + void givenString_whenUsingParseLong_thenObtainLongPrimitive() { long l = Long.parseLong("2147483648"); assertThat(l).isEqualTo(2147483648L); } @Test - public void givenInvalidString_whenUsingParseLong_thenNumberFormatExceptionThrown() { + void givenInvalidString_whenUsingParseLong_thenNumberFormatExceptionThrown() { Assertions.assertThrows(NumberFormatException.class, () -> Long.parseLong("Invalid String")); } @Test - public void givenHexadecimalString_whenUsingLongDecode_thenObtainLongObject() { + void givenHexadecimalString_whenUsingLongDecode_thenObtainLongObject() { Long l = Long.decode("0x80000000"); assertThat(l).isEqualTo(2147483648L); } @Test - public void givenInvalidString_whenUsingLongDecode_thenNumberFormatExceptionThrown() { + void givenInvalidString_whenUsingLongDecode_thenNumberFormatExceptionThrown() { Assertions.assertThrows(NumberFormatException.class, () -> Long.decode("Invalid String")); } @Test - public void givenHexadecimalString_whenUsingApacheCommonsNumberUtils_thenObtainLongObject() { + void givenHexadecimalString_whenUsingApacheCommonsNumberUtils_thenObtainLongObject() { Long l = NumberUtils.createLong("0x80000000"); assertThat(l).isEqualTo(2147483648L); } @Test - public void givenInvalidString_whenUsingApacheCommonsNumberUtils_thenNumberFormatExceptionThrown() { + void givenInvalidString_whenUsingApacheCommonsNumberUtils_thenNumberFormatExceptionThrown() { Assertions.assertThrows(NumberFormatException.class, () -> NumberUtils.createLong("Invalid String")); } @Test - public void givenString_whenUsingParseUnsignedLong_thenObtainUnsignedLongObject() { + void givenString_whenUsingParseUnsignedLong_thenObtainUnsignedLongObject() { Long l = Long.parseUnsignedLong("9223372036854775808"); assertThat(Long.toUnsignedString(l)).isEqualTo("9223372036854775808"); } @Test - public void givenInvalidString_whenUsingParseUnsignedLong_thenNumberFormatExceptionThrown() { + void givenInvalidString_whenUsingParseUnsignedLong_thenNumberFormatExceptionThrown() { Assertions.assertThrows(NumberFormatException.class, () -> Long.parseUnsignedLong("Invalid String")); } @Test - public void givenString_whenUsingGuavaLongs_thenObtainLongObject() { + void givenString_whenUsingGuavaLongs_thenObtainLongObject() { Long l = Longs.tryParse("2147483648"); assertThat(l).isEqualTo(2147483648L); } @Test - public void givenInvalidString_whenUsingGuavaLongs_thenObtainNull() { + void givenInvalidString_whenUsingGuavaLongs_thenObtainNull() { assertThat(Longs.tryParse("Invalid String")).isNull(); } } \ No newline at end of file