@Override public void bootstrap() { if (maintenanceDAO.count() == 0) { maintenanceDAO.createMaintenance(Maintenance.getMaintenance(Maintenance.FULL)); maintenanceDAO.createMaintenance(Maintenance.getMaintenance(Maintenance.TEST)); maintenanceDAO.createMaintenance(Maintenance.getMaintenance(Maintenance.NONE)); } }
/** * Set up the context * * @throws Exception */ @Before public void setUp() throws Exception { fullMaintenance = Maintenance.getMaintenance(Maintenance.FULL); maintenanceDAO.createMaintenance(fullMaintenance); fullMaintenanceId = fullMaintenance.getId(); noneMaintenance = Maintenance.getMaintenance(Maintenance.NONE); maintenanceDAO.createMaintenance(noneMaintenance); noneMaintenanceId = noneMaintenance.getId(); }
/** * Test the createMaintenance(Maintenance) method : the DAO must have an additionnal entity after * the creation */ @Test public void testCreateMaintenance() { int count = (int) maintenanceDAO.count(); Maintenance m = Maintenance.getMaintenance(Maintenance.TEST); maintenanceDAO.createMaintenance(m); assertEquals(count + 1, maintenanceDAO.count()); }
/** * Create and persist an {@link Client} object * * @throws Exception */ @Before public void setUp() throws Exception { maintenance = Maintenance.getMaintenance(Maintenance.TEST); maintenanceDAO.createMaintenance(maintenance); client = new Client(); client.setName("client"); clientDAO.createClient(client); clientId = client.getId(); }
/** Test if the modification of an entity has been correctly done */ @Test public void testUpdateMaintenance() { noneMaintenance.setName("Very full"); maintenanceDAO.updateMaintenance(noneMaintenance); assertEquals("Very full", maintenanceDAO.findById(noneMaintenanceId).getName()); }
/** {@inheritDoc} */ @Override public String getAsText() { Maintenance m = (Maintenance) getValue(); return (m == null) ? null : "" + m.getId(); }