コード例 #1
0
 @Test
 public void successfulRegistration() {
   when(this.cut.priceCalculator.calculateTotal(Matchers.anyBoolean(), Matchers.anyInt()))
       .thenReturn(1);
   final Registration registration = new Registration(true, 1, 1);
   merge(registration);
   this.cut.register(registration);
 }
コード例 #2
0
  @Before
  public void basicInit() throws KException {
    transaction = Mockito.mock(UnitOfWork.class);
    Mockito.when(transaction.getState()).thenReturn(State.NOT_STARTED);

    UnitOfWork uow = Mockito.mock(UnitOfWork.class);
    Mockito.when(uow.getState()).thenReturn(State.NOT_STARTED);

    repository = Mockito.mock(Repository.class);
    UnitOfWorkListener listener = Matchers.any();
    Mockito.when(
            repository.createTransaction(
                Matchers.anyString(), Matchers.anyString(), Matchers.anyBoolean(), listener))
        .thenReturn(uow);
  }