From 458652a3daceb47d4fbcbbfe8d13b81e6cbe2895 Mon Sep 17 00:00:00 2001 From: patkorek Date: Fri, 10 Apr 2020 12:49:52 +0200 Subject: [PATCH] Modified one method --- .../com/baeldung/strings/ConvertStringToInt.groovy | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/core-groovy/src/test/groovy/com/baeldung/strings/ConvertStringToInt.groovy b/core-groovy/src/test/groovy/com/baeldung/strings/ConvertStringToInt.groovy index 3b179ee193..3b73c31596 100644 --- a/core-groovy/src/test/groovy/com/baeldung/strings/ConvertStringToInt.groovy +++ b/core-groovy/src/test/groovy/com/baeldung/strings/ConvertStringToInt.groovy @@ -62,10 +62,17 @@ class ConvertStringToInt { def stringNum = "123" int expectedInt = 123 int intNum = new Integer(stringNum).intValue() - int secondIntNum = new Integer(stringNum) assertEquals(intNum, expectedInt) - assertEquals(secondIntNum, expectedInt) + } + + @Test + void givenString_whenUsingNewInteger_thenConvertToInteger() { + def stringNum = "123" + int expectedInt = 123 + int intNum = new Integer(stringNum) + + assertEquals(intNum, expectedInt) } @Test