@Test public void testUpdateForSuccess() { ExternalMeasure measure = createExternalMeasure("view_item_hourly"); measure.setId(1L); given(measureRepo.findOne(1L)).willReturn(measure); given(measureRepo.save(Matchers.any(ExternalMeasure.class))) .willReturn(measure); operator.create(measure); verify(measureRepo, times(1)).save( Matchers.any(ExternalMeasure.class)); }
@Override @Transactional public Measure create(Measure measure) { ExternalMeasure em = (ExternalMeasure) measure; validateMeasure(em); em.setVirtualJob(new VirtualJob()); em = measureRepo.save(em); VirtualJob vj = genVirtualJob(em, em.getVirtualJob()); jobRepo.save(vj); return em; }
ExternalMeasureOperatorImpl implements MeasureOperator { @Override @Transactional public Measure create(Measure measure) { ExternalMeasure em = (ExternalMeasure) measure; validateMeasure(em); em.setVirtualJob(new VirtualJob()); em = measureRepo.save(em); VirtualJob vj = genVirtualJob(em, em.getVirtualJob()); jobRepo.save(vj); return em; } }
ExternalMeasureOperatorImpl implements MeasureOperator { @Override @Transactional public Measure create(Measure measure) { ExternalMeasure em = (ExternalMeasure) measure; validateMeasure(em); em.setVirtualJob(new VirtualJob()); em = measureRepo.save(em); VirtualJob vj = genVirtualJob(em, em.getVirtualJob()); jobRepo.save(vj); return em; }  }
ExternalMeasureOperatorImpl implements MeasureOperator { @Override @Transactional public Measure create(Measure measure) { ExternalMeasure em = (ExternalMeasure) measure; validateMeasure(em); em.setVirtualJob(new VirtualJob()); em = measureRepo.save(em); VirtualJob vj = genVirtualJob(em, em.getVirtualJob()); jobRepo.save(vj); return em; }  @Override @Transactional Measure create(Measure measure); @Override Measure update(Measure measure); @Override void delete(Measure measure); }
ExternalMeasureOperatorImpl implements MeasureOperator { @Override @Transactional public Measure create(Measure measure) { ExternalMeasure em = (ExternalMeasure) measure; validateMeasure(em); em.setVirtualJob(new VirtualJob()); em = measureRepo.save(em); VirtualJob vj = genVirtualJob(em, em.getVirtualJob()); jobRepo.save(vj); return em; }  @Override @Transactional Measure create(Measure measure); @Override Measure update(Measure measure); @Override void delete(Measure measure);  }