blob: 4cbdf762be55e3ed4d6ecedbcab8f39d1f319a58 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
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 /");
}
}
|