blob: 3202a7b08c41fe4af2963f4b1096bba493d07e0f (
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
|
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.
*
*/
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(new Long(12), new Long(12));
assertEquals("Size", 12, 13);
assertEquals("Capacity", 12.0, 11.99, 0.0);
}
}
|