diff options
| author | Martin Weick <e1627760@student.tuwien.ac.at> | 2018-05-04 13:51:05 +0200 | 
|---|---|---|
| committer | Tharre <tharre3@gmail.com> | 2018-05-04 20:37:04 +0200 | 
| commit | a62919d43debaa0c6baf32de9658740dc929cba6 (patch) | |
| tree | a6e8ac973b6221f0e1f113054163aa2cacb809f9 /src/main | |
| parent | 0c8e84cf27f3477b1287295f8dec2e0d1e4039d0 (diff) | |
| download | sepm-groupproject-a62919d43debaa0c6baf32de9658740dc929cba6.tar.gz sepm-groupproject-a62919d43debaa0c6baf32de9658740dc929cba6.tar.xz sepm-groupproject-a62919d43debaa0c6baf32de9658740dc929cba6.zip  | |
tests
Diffstat (limited to 'src/main')
| -rw-r--r-- | src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/service/VehicleAdd.java | 6 | ||||
| -rw-r--r-- | src/main/resources/controller/createCar.fxml (renamed from src/main/resources/controller/CreateCar.fxml) | 0 | ||||
| -rw-r--r-- | src/main/test/java/at/ac/tuwien/sepm/assignment/groupphase/AddCarTest.java | 43 | 
3 files changed, 4 insertions, 45 deletions
diff --git a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/service/VehicleAdd.java b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/service/VehicleAdd.java index be52fb6..e78c6b2 100644 --- a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/service/VehicleAdd.java +++ b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/service/VehicleAdd.java @@ -42,17 +42,19 @@ public class VehicleAdd implements VehicleService {              case NEF:                  if (vehicle.constructionType() == ConstructionType.MITTELHOCHDACH) {                      throw new InvalidVehicleException("NEF darf kein Mittelhochdach haben"); -                } else if (vehicle.constructionType().name().contains("Hochdach")) { +                } else if (vehicle.constructionType() == ConstructionType.HOCHDACH) {                      throw new InvalidVehicleException("NEF darf kein Hochdach haben");                  }                  break;              case NAH:                  if (vehicle.constructionType() == ConstructionType.MITTELHOCHDACH) {                      throw new InvalidVehicleException("NEF darf kein Mittelhochdach haben"); -                } else if (vehicle.constructionType().name().contains("Hochdach")) { +                } else if (vehicle.constructionType() == ConstructionType.HOCHDACH) {                      throw new InvalidVehicleException("NEF darf kein Hochdach haben");                  }                  break; +            case BKTW: +                break;              default:                  throw new ServiceException("not a Valid type");          } diff --git a/src/main/resources/controller/CreateCar.fxml b/src/main/resources/controller/createCar.fxml index 2daac67..2daac67 100644 --- a/src/main/resources/controller/CreateCar.fxml +++ b/src/main/resources/controller/createCar.fxml diff --git a/src/main/test/java/at/ac/tuwien/sepm/assignment/groupphase/AddCarTest.java b/src/main/test/java/at/ac/tuwien/sepm/assignment/groupphase/AddCarTest.java deleted file mode 100644 index e7c4543..0000000 --- a/src/main/test/java/at/ac/tuwien/sepm/assignment/groupphase/AddCarTest.java +++ /dev/null @@ -1,43 +0,0 @@ -package at.ac.tuwien.sepm.assignment.groupphase; - -import static junit.framework.TestCase.fail; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dao.VehicleDAO; -import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dao.VehicleDBDAO; -import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dto.Vehicle; -import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dto.Vehicle.ConstructionType; -import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dto.Vehicle.VehicleType; -import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.service.VehicleAdd; -import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.service.VehicleService; -import at.ac.tuwien.sepm.assignment.groupphase.exception.InvalidVehicleException; -import at.ac.tuwien.sepm.assignment.groupphase.exception.PersistenceException; -import at.ac.tuwien.sepm.assignment.groupphase.exception.ServiceException; -import org.junit.Test; - -public class AddCarTest { -    private final VehicleDAO vehicleP = mock(VehicleDBDAO.class); -    private final VehicleService vehicleService = new VehicleAdd(vehicleP); - -    public AddCarTest() throws PersistenceException { -        when(vehicleP.add(any())).thenReturn(1L); -    } - -    @Test -    public void add() { -        Vehicle vehicle = -                Vehicle.builder() -                        .constructionType(ConstructionType.HOCHDACH) -                        .type(VehicleType.RTW) -                        .hasNef(true) -                        .build(); -        try { -            vehicleService.add(vehicle); -        } catch (InvalidVehicleException | ServiceException e) { -            fail(); -        } -    } - -}  | 
