From dc5ea1e78eee529090d739774889639fab1c181c Mon Sep 17 00:00:00 2001 From: Stefan Suhren Date: Wed, 14 Jan 2015 14:12:03 +0100 Subject: Assignment No.13 after correction --- .../fhswf/in/inf/java1/aufgabe13/GeneralTests.java | 75 ++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 tests/de/fhswf/in/inf/java1/aufgabe13/GeneralTests.java (limited to 'tests/de/fhswf/in/inf/java1/aufgabe13/GeneralTests.java') diff --git a/tests/de/fhswf/in/inf/java1/aufgabe13/GeneralTests.java b/tests/de/fhswf/in/inf/java1/aufgabe13/GeneralTests.java new file mode 100644 index 0000000..4cbdf76 --- /dev/null +++ b/tests/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 /"); + } + +} -- cgit v1.2.3-70-g09d2