From b2a66673c2d7d67fbb967c17c038814c4cec166c Mon Sep 17 00:00:00 2001 From: Stefan Suhren Date: Mon, 12 Jan 2015 19:31:40 +0100 Subject: Assignment No.13 first implementation. --- .../fhswf/in/inf/java1/aufgabe13/GeneralTests.java | 75 ++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 src/de/fhswf/in/inf/java1/aufgabe13/GeneralTests.java (limited to 'src/de/fhswf/in/inf/java1/aufgabe13/GeneralTests.java') 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 /"); + } + +} -- cgit v1.2.3-70-g09d2