コード例 #1
0
  /** Test insert location. */
  @Test
  public void testAssignCard() {
    CallingCardMaintenanceRequest request = new CallingCardMaintenanceRequest();
    CommonTestRoutines.createDummyUserContext(request);

    CallingCardInfo callingCardInfo = new CallingCardInfo();
    callingCardInfo.setPersonId(1);
    callingCardInfo.setModelAction(PersistanceActionEnum.INSERT);

    request.setCallingCardInfo(callingCardInfo);

    Mockito.when(getMockCallingCardBAC().assignCard(request))
        .thenReturn(returnInsert(callingCardInfo));

    CallingCardMaintenanceResponse response = getCallingCardBAI().assignCard(request);

    CommonTestRoutines.assertResponse(response);

    // ensures the mock's assignCard was called 1 time.
    Mockito.verify(getMockCallingCardBAC()).assignCard(request);
  }
コード例 #2
0
  @Test
  public void testRefillCardNoAmount() {
    CallingCardMaintenanceRequest request = new CallingCardMaintenanceRequest();
    CommonTestRoutines.createDummyUserContext(request);

    CallingCardInfo callingCardInfo = new CallingCardInfo();
    callingCardInfo.setPersonId(1);
    callingCardInfo.setModelAction(PersistanceActionEnum.UPDATE);

    request.setCallingCardInfo(callingCardInfo);

    Mockito.when(getMockCallingCardBAC().refillCard(request))
        .thenReturn(returnInsert(callingCardInfo));

    CallingCardMaintenanceResponse response = getCallingCardBAI().refillCard(request);

    assertEquals("", 1, response.getMessageList().size());

    assertEquals(
        "",
        PROSPERITASGLOBAL_BASE_CALLINGCARDVALIDATOR_AMOUNT_REQUIRED,
        response.getMessageList().get(0).getMessageInfo().getCode());
  }