summaryrefslogtreecommitdiffstats
path: root/src/de/fhswf/in/inf/java1/aufgabe13/GeneralTests.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/de/fhswf/in/inf/java1/aufgabe13/GeneralTests.java')
-rw-r--r--src/de/fhswf/in/inf/java1/aufgabe13/GeneralTests.java75
1 files changed, 75 insertions, 0 deletions
diff --git a/src/de/fhswf/in/inf/java1/aufgabe13/GeneralTests.java b/src/de/fhswf/in/inf/java1/aufgabe13/GeneralTests.java
new file mode 100644
index 0000000..4cbdf76
--- /dev/null
+++ b/src/de/fhswf/in/inf/java1/aufgabe13/GeneralTests.java
@@ -0,0 +1,75 @@
+/**
+ *
+ */
+package de.fhswf.in.inf.java1.aufgabe13;
+
+import org.junit.Test;
+
+import de.fhswf.in.inf.java1.aufgabe12.UPN;
+
+/**
+ * Test the UPN class.
+ *
+ * @author $Author: $
+ * @version $Revision: $, $Date: $ UTC
+ */
+public class GeneralTests
+{
+
+ /**
+ * Test method for
+ * {@link de.fhswf.in.inf.java1.aufgabe12.UPN#calculate(java.lang.String)}.
+ */
+ @Test(expected = IllegalArgumentException.class)
+ public final void testInvalidNumbers()
+ {
+ // UPN is tested
+ UPN tester = new UPN();
+
+ // Test
+ tester.calculate("1g 3 +");
+ }
+
+ /**
+ * Test method for
+ * {@link de.fhswf.in.inf.java1.aufgabe12.UPN#calculate(java.lang.String)}.
+ */
+ @Test(expected = IllegalArgumentException.class)
+ public final void testInvalidOperator()
+ {
+ // UPN is tested
+ UPN tester = new UPN();
+
+ // Test
+ tester.calculate("1 cinus");
+ }
+
+ /**
+ * Test method for
+ * {@link de.fhswf.in.inf.java1.aufgabe12.UPN#calculate(java.lang.String)}.
+ */
+ @Test(expected = IllegalArgumentException.class)
+ public final void testMissingOperands()
+ {
+ // UPN is tested
+ UPN tester = new UPN();
+
+ // Test
+ tester.calculate("1 +");
+ }
+
+ /**
+ * Test method for
+ * {@link de.fhswf.in.inf.java1.aufgabe12.UPN#calculate(java.lang.String)}.
+ */
+ @Test(expected = IllegalArgumentException.class)
+ public final void testDevisionByZero()
+ {
+ // UPN is tested
+ UPN tester = new UPN();
+
+ // Test
+ tester.calculate("1 0 /");
+ }
+
+}