001 package test; 002 003 import java.util.HashMap; 004 import java.util.HashSet; 005 import java.util.Map; 006 import java.util.Set; 007 008 import physics3d.Vect3; 009 010 import components.Ball; 011 import components.GameObject; 012 import components.GameSettings; 013 import components.GameSpace; 014 import components.RightFlipper; 015 016 import junit.framework.TestCase; 017 018 public class TestGetOccupiedPositions extends TestCase { 019 GameSpace gs; 020 021 RightFlipper rf; 022 023 Ball b; 024 025 public TestGetOccupiedPositions(String name) { 026 super(name); 027 028 gs = new GameSpace(new GameSettings()); 029 030 Map<String, String> fmap = new HashMap<String, String>(); 031 fmap.put("x", "1"); 032 fmap.put("y", "1"); 033 fmap.put("z", "0"); 034 fmap.put("orientation", "0"); 035 fmap.put("name", "right flipper"); 036 rf = new RightFlipper(fmap, gs); 037 038 Map<String, String> fmap2 = new HashMap<String, String>(); 039 fmap2.put("x", ".5" + 040 ""); 041 fmap2.put("y", ".5"); 042 fmap2.put("z", ".5"); 043 fmap2.put("orientation", "0"); 044 fmap2.put("name", "ball"); 045 b = new Ball(fmap2, gs); 046 047 } 048 049 protected void setUp() {} 050 051 public void testRF1 () { 052 Set<Vect3> op = new HashSet<Vect3>(); 053 op.add(new Vect3(1, 1, 0)); 054 op.add(new Vect3(2, 1, 0)); 055 op.add(new Vect3(2, 2, 0)); 056 op.add(new Vect3(1, 2, 0)); 057 checkRF(rf, op); 058 059 } 060 061 public void testB1() { 062 Set<Vect3> op = new HashSet<Vect3>(); 063 op.add(Vect3.ZERO); 064 } 065 066 protected void checkRF (GameObject go, Set<Vect3> op) { 067 assertEquals(go.getOccupiedPositions(), op); 068 } 069 070 } 071