@Test public void testCreateForSuccess() { ExternalMeasure measure = createExternalMeasure("view_item_hourly"); given(measureRepo.save(measure)).willReturn(measure); given(jobRepo.save(Matchers.any(VirtualJob.class))).willReturn( new VirtualJob()); operator.create(measure); verify(jobRepo, times(1)).save(new VirtualJob()); }
@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);  }