2022-04-06 23:58:57 +02:00
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
|
|
|
|
import static org.junit.jupiter.api.Assertions.*;
|
|
|
|
|
|
|
|
class Aufgabe2_KellerautomatTest {
|
|
|
|
|
|
|
|
@Test
|
|
|
|
void calculate() {
|
2022-04-07 00:25:44 +02:00
|
|
|
assertEquals(6664, Aufgabe2_Kellerautomat.calculate("34+62+89+43+***"));
|
|
|
|
assertEquals(58, Aufgabe2_Kellerautomat.calculate("31+78+987+1214++7++++++"));
|
2022-04-10 17:46:10 +02:00
|
|
|
|
|
|
|
assertThrows(IllegalArgumentException.class,()->Aufgabe2_Kellerautomat.calculate("34+34+"));
|
|
|
|
assertThrows(IllegalArgumentException.class,()->Aufgabe2_Kellerautomat.calculate("34+*"));
|
|
|
|
assertThrows(IllegalArgumentException.class,()->Aufgabe2_Kellerautomat.calculate("8+9+7*2*"));
|
2022-04-10 18:18:06 +02:00
|
|
|
assertThrows(IllegalArgumentException.class,()->Aufgabe2_Kellerautomat.calculate("57-"));
|
2022-04-06 23:58:57 +02:00
|
|
|
}
|
|
|
|
}
|