mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-28 06:55:02 +08:00
Handle inputs like "2 +"
in StackPostfixNotation
(#4262)
This commit is contained in:
@ -30,4 +30,14 @@ public class StackPostfixNotationTest {
|
||||
public void testIfEvaluateThrowsExceptionForInputWithUnknownOperation() {
|
||||
assertThrows(IllegalArgumentException.class, () -> StackPostfixNotation.postfixEvaluate("3 3 !"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIfEvaluateThrowsExceptionForInputWithTooFewArgsA() {
|
||||
assertThrows(IllegalArgumentException.class, () -> StackPostfixNotation.postfixEvaluate("+"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIfEvaluateThrowsExceptionForInputWithTooFewArgsB() {
|
||||
assertThrows(IllegalArgumentException.class, () -> StackPostfixNotation.postfixEvaluate("2 +"));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user