/
SimpleTest.java
47 lines (37 loc) · 965 Bytes
/
SimpleTest.java
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
package org.junit.samples;
import static org.junit.Assert.assertEquals;
import junit.framework.JUnit4TestAdapter;
import org.junit.Before;
import org.junit.Test;
/**
* Some simple tests.
*
* <p>This test is expected to fail.
*/
public class SimpleTest {
protected int fValue1;
protected int fValue2;
@Before
public void setUp() {
fValue1 = 2;
fValue2 = 3;
}
public static junit.framework.Test suite() {
return new JUnit4TestAdapter(SimpleTest.class);
}
public int unused;
@Test
public void divideByZero() {
int zero = 0;
int result = 8 / zero;
unused = result; // avoid warning for not using result
}
@Test
public void testEquals() {
assertEquals(12, 12);
assertEquals(12L, 12L);
assertEquals(Long.valueOf(12), Long.valueOf(12));
assertEquals("Size", 12, 13);
assertEquals("Capacity", 12.0, 11.99, 0.0);
}
}