|
@@ -1,5 +1,6 @@
|
|
|
import org.junit.jupiter.api.Assertions;
|
|
import org.junit.jupiter.api.Assertions;
|
|
|
import org.junit.jupiter.api.Test;
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
|
+import pl.konrad.NegativeNumberException;
|
|
|
import pl.konrad.StringCalculator;
|
|
import pl.konrad.StringCalculator;
|
|
|
|
|
|
|
|
public class StringCalculatorTest {
|
|
public class StringCalculatorTest {
|
|
@@ -35,8 +36,11 @@ public class StringCalculatorTest {
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
@Test
|
|
|
- public void testStringCalcForNegativeNumbers(){
|
|
|
|
|
- Assertions.assertThrows(RuntimeException.class,"")
|
|
|
|
|
|
|
+ public void testStringCalcForNegativeNumbers() {
|
|
|
|
|
+ Exception exception = Assertions.assertThrows(NegativeNumberException.class,()-> test(3, "//;\n1;-2"));
|
|
|
|
|
+ Assertions.assertEquals("negatives not allowed",exception.getMessage());
|
|
|
|
|
+ Exception exception2 = Assertions.assertThrows(NegativeNumberException.class,()-> test(11, "//a\n3a-3a-5"));
|
|
|
|
|
+ Assertions.assertEquals("negatives not allowed",exception2.getMessage());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|