예제 #1
0
  @Test
  public void testSetPumpOnOff() {

    presenter.setPumpOnOff(1, false);

    List<Pump> pumps = plant.getPumps();

    assertEquals("Result", false, pumps.get(0).isOn());
  }
예제 #2
0
  @Test
  public void testSetPumpRpm() {

    presenter.setPumpRpm(1, 127);

    List<Pump> pumps = plant.getPumps();

    assertEquals("Result", 127, pumps.get(0).getRpm());
  }
예제 #3
0
  /**
   * Tests whether setting each breakable component within the power plant has the affect of adding
   * it to the list of broken components and that it's isOperational() returns false.
   */
  @Test
  public void testSetComponentFailed() {
    // Test Operator Software manual break
    presenter.setComponentFailed(falableComponents.OperatorSoftare);
    assertTrue(plant.getFailedComponents().contains(plant.getOperatingSoftware()));
    assertTrue(!plant.getOperatingSoftware().isOperational());

    // Test Pump1 manual break
    presenter.setComponentFailed(falableComponents.Pump1);
    assertTrue(plant.getFailedComponents().contains(plant.getPumps().get(0)));
    assertTrue(!plant.getPumps().get(0).isOperational());

    // Test Pump2 manual break
    presenter.setComponentFailed(falableComponents.Pump2);
    assertTrue(plant.getFailedComponents().contains(plant.getPumps().get(1)));
    assertTrue(!plant.getPumps().get(1).isOperational());

    // Test Pump3 manual break
    presenter.setComponentFailed(falableComponents.Pump3);
    assertTrue(plant.getFailedComponents().contains(plant.getPumps().get(2)));
    assertTrue(!plant.getPumps().get(2).isOperational());

    // Test Turbine manual break
    presenter.setComponentFailed(falableComponents.Turbine);
    assertTrue(plant.getFailedComponents().contains(plant.getTurbine()));
    assertTrue(!plant.getTurbine().isOperational());
  }
예제 #4
0
  // 4.4 4.8
  @Test
  public void testRepairPump() {

    assertEquals("Result", false, presenter.repairPump(1));

    // break the pump
    List<PlantComponent> failedComponents = plant.getFailedComponents();
    failedComponents.add(plant.getPumps().get(0));

    assertEquals("Result", true, presenter.repairPump(1));

    assertEquals("Result", false, presenter.repairPump(1));
  }