Пример #1
0
  @Test
  public void testProcessWithoutClasses() throws Exception {
    ModelProcessor modelProcessor = mock(ModelProcessor.class);
    DefaultModelGenerator dmg =
        new ModelGeneratorBuilder().setModelProcessor(modelProcessor).build();

    dmg.processAll(new ArrayList<Model>());

    InOrder mpInOrder = inOrder(modelProcessor);
    mpInOrder.verify(modelProcessor, times(1)).startProcessing();
    mpInOrder.verify(modelProcessor, times(1)).endProcessing();
    verify(modelProcessor, never()).processModel(any(Model.class), any(ItemStatus.class));
  }
Пример #2
0
  @Test
  public void testProcessWithList() throws Exception {
    ModelProcessor modelProcessor = mock(ModelProcessor.class);
    DefaultModelGenerator modelGenerator =
        new ModelGeneratorBuilder().setModelProcessor(modelProcessor).build();

    Model testModel1 = mock(Model.class);
    Model testModel2 = mock(Model.class);
    modelGenerator.processAll(TestUtil.collectionFromObjects(testModel1, testModel2));

    InOrder mpInOrder = inOrder(modelProcessor);
    mpInOrder.verify(modelProcessor, times(1)).startProcessing();
    mpInOrder
        .verify(modelProcessor, times(2))
        .processModel(any(Model.class), any(ItemStatus.class));
    mpInOrder.verify(modelProcessor, times(1)).endProcessing();
  }