1 | package jpacman.controller; |
2 | |
3 | import static org.junit.Assert.*; |
4 | |
5 | import java.awt.Image; |
6 | import java.io.IOException; |
7 | |
8 | import org.junit.Before; |
9 | import org.junit.Test; |
10 | |
11 | /** |
12 | * Fairly basic test cases for the image factory. |
13 | * @author Arie van Deursen, TU Delft, created 2007. |
14 | */ |
15 | public class ImageFactoryTest { |
16 | |
17 | /** |
18 | * The factory under test. |
19 | */ |
20 | private ImageFactory imf; |
21 | |
22 | /** |
23 | * Actually create the image factory. |
24 | * @throws IOException if images can't be found. |
25 | */ |
26 | @Before public void setUp() throws IOException { |
27 | imf = new ImageFactory(); |
28 | } |
29 | |
30 | /** |
31 | * Are images for player properly loaded? |
32 | */ |
33 | @Test public void testPlayer() { |
34 | Image up = imf.player(0, -1, 1); |
35 | Image down = imf.player(0, 1, 1); |
36 | assertNotSame(up, down); |
37 | } |
38 | |
39 | /** |
40 | * Are monster images properly loaded? |
41 | */ |
42 | @Test public void testMonster() { |
43 | Image m1 = imf.monster(0); |
44 | Image m2 = imf.monster(0); |
45 | assertEquals(m1, m2); |
46 | } |
47 | } |