/** Testet ob die Methode getID den richtigen Wert zurueck gibt */ @Test public void testGetThreadeeID() { this.testDir.mkdirs(); this.logDir.mkdirs(); final Simulation sim = new Simulation(100, 1, 1, this.testDir, this.logDir); Employee e = new Employee(sim, 1); Threadee t = new Threadee(1, e, null); assertEquals(1, t.getID()); }
/** Testet ob die Methode hashCode einen richtigen Hash Code generiert */ @Test public void testHashCode1() { this.testDir.mkdirs(); this.logDir.mkdirs(); final Simulation sim = new Simulation(100, 1, 1, this.testDir, this.logDir); PartType pt1 = PartType.EYE; PartType pt2 = PartType.EYE; PartType pt3 = PartType.ARM; PartType pt4 = PartType.ARM; PartType pt5 = PartType.CHAINDRIVE; PartType pt6 = PartType.BODY; Part p1 = new Part(pt1, new int[3]); Part p2 = new Part(pt2, new int[3]); Part p3 = new Part(pt3, new int[3]); Part p4 = new Part(pt4, new int[3]); Part p5 = new Part(pt5, new int[3]); Part p6 = new Part(pt6, new int[3]); List<Part> list = new ArrayList<Part>(); list.add(p1); list.add(p2); list.add(p3); list.add(p4); list.add(p5); list.add(p6); Employee e = new Employee(sim, 1); Threadee t = new Threadee(1, e, list); final int prime = 31; int result = 1; result = prime * result + ((e == null) ? 0 : e.hashCode()); result = prime * result + (int) (t.getID() ^ (t.getID() >>> 32)); result = prime * result + ((list == null) ? 0 : list.hashCode()); assertEquals(result, t.hashCode()); }