@Test(expected = GriffinException.NotFoundException.class) public void testDeleteMeasureByIdFailureWithNotFound() throws SchedulerException { given(measureRepo.findByIdAndDeleted(1L, false)).willReturn(null); service.deleteMeasureById(1L); }
@Override public void deleteMeasureById(Long measureId) throws SchedulerException { Measure measure = measureRepo.findByIdAndDeleted(measureId, false); if (measure == null) { throw new GriffinException.NotFoundException( MEASURE_ID_DOES_NOT_EXIST); } MeasureOperator op = getOperation(measure); op.delete(measure); }
MeasureServiceImpl implements MeasureService { @Override public void deleteMeasureById(Long measureId) throws SchedulerException { Measure measure = measureRepo.findByIdAndDeleted(measureId, false); if (measure == null) { throw new GriffinException.NotFoundException( MEASURE_ID_DOES_NOT_EXIST); } MeasureOperator op = getOperation(measure); op.delete(measure); } }
MeasureServiceImpl implements MeasureService { @Override public void deleteMeasureById(Long measureId) throws SchedulerException { Measure measure = measureRepo.findByIdAndDeleted(measureId, false); if (measure == null) { throw new GriffinException.NotFoundException( MEASURE_ID_DOES_NOT_EXIST); } MeasureOperator op = getOperation(measure); op.delete(measure); }  }
MeasureServiceImpl implements MeasureService { @Override public void deleteMeasureById(Long measureId) throws SchedulerException { Measure measure = measureRepo.findByIdAndDeleted(measureId, false); if (measure == null) { throw new GriffinException.NotFoundException( MEASURE_ID_DOES_NOT_EXIST); } MeasureOperator op = getOperation(measure); op.delete(measure); }  @Override List<? extends Measure> getAllAliveMeasures(String type); @Override Measure getMeasureById(long id); @Override List<Measure> getAliveMeasuresByOwner(String owner); @Override Measure createMeasure(Measure measure); @Override Measure updateMeasure(Measure measure); @Override void deleteMeasureById(Long measureId); @Override void deleteMeasures(); }
MeasureServiceImpl implements MeasureService { @Override public void deleteMeasureById(Long measureId) throws SchedulerException { Measure measure = measureRepo.findByIdAndDeleted(measureId, false); if (measure == null) { throw new GriffinException.NotFoundException( MEASURE_ID_DOES_NOT_EXIST); } MeasureOperator op = getOperation(measure); op.delete(measure); }  @Override List<? extends Measure> getAllAliveMeasures(String type); @Override Measure getMeasureById(long id); @Override List<Measure> getAliveMeasuresByOwner(String owner); @Override Measure createMeasure(Measure measure); @Override Measure updateMeasure(Measure measure); @Override void deleteMeasureById(Long measureId); @Override void deleteMeasures();  }