/** * Test method for {@link edu.ncsu.csc216.androtech.model.management.ServiceManager#printDroids()} * . */ @Test public void testPrintDroids() { serviceManager = new ServiceManager(); boolean thrown = true; try { scanner = new Scanner(new File("oneDevice.txt")); serviceManager = new ServiceManager(scanner); assertEquals( serviceManager .printDroids() .equals( "05V: UNASSIGNED\n03V: UNASSIGNED\n02E: UNASSIGNED\n01C: UNASSIGNED\n04C: UNASSIGNED"), true); assertEquals( serviceManager.printWaitList("").equals("V Gold 0987-N-817 Fath Hoth"), true); serviceManager.assignDroids(); assertEquals(serviceManager.printWaitList("").equals(""), true); assertEquals( serviceManager .printDroids() .equals( "05V: 0987-N-817 Fath Hoth\n03V: UNASSIGNED\n02E: UNASSIGNED\n01C: UNASSIGNED\n04C: UNASSIGNED"), true); } catch (FileNotFoundException e) { thrown = false; } assertTrue(thrown); }
/** * Test method for {@link edu.ncsu.csc216.androtech.model.management.ServiceManager#addNewDroid()} * . */ @Test public void testAddNewDroid() { serviceManager = new ServiceManager(); assertTrue( serviceManager .printDroids() .equals( "05V: UNASSIGNED\n03V: UNASSIGNED\n02E: " + "UNASSIGNED\n01C: UNASSIGNED\n04C: UNASSIGNED")); serviceManager.addNewDroid(); assertTrue( serviceManager .printDroids() .equals( "05V: UNASSIGNED\n03V: UNASSIGNED\n02E: " + "UNASSIGNED\n01C: UNASSIGNED\n04C: UNASSIGNED\n06C: UNASSIGNED")); }
/** * Test method for {@link * edu.ncsu.csc216.androtech.model.management.ServiceManager#assignDroids()} . */ @Test public void testAssignDroids() { serviceManager = new ServiceManager(); serviceManager.putOnWaitingList(vRDevice1); serviceManager.putOnWaitingList(comDevice1); assertEquals( serviceManager.printWaitList(""), "V Gold 0987-N-817 Fath Hoth\nC Gold 0987-N-817 Fath Hoth"); serviceManager.assignDroids(); assertEquals(serviceManager.printWaitList("").equals(""), true); assertEquals( serviceManager .printDroids() .equals( "05V: 0987-N-817 Fath Hoth\n03V: UNASSIGNED\n02E:" + " UNASSIGNED\n01C: UNASSIGNED\n04C: 0987-N-817 Fath Hoth"), true); }