コード例 #1
0
  @Test
  public void testRefillCardNoIdNoAmount() {
    CallingCardMaintenanceRequest request = new CallingCardMaintenanceRequest();
    CommonTestRoutines.createDummyUserContext(request);

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

    request.setCallingCardInfo(callingCardInfo);

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

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

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

    assertEquals(
        "",
        PROSPERITASGLOBAL_BASE_CALLINGCARDVALIDATOR_PERSON_ID_REQUIRED,
        response.getMessageList().get(0).getMessageInfo().getCode());
    assertEquals(
        "",
        PROSPERITASGLOBAL_BASE_CALLINGCARDVALIDATOR_AMOUNT_REQUIRED,
        response.getMessageList().get(1).getMessageInfo().getCode());
  }
コード例 #2
0
  @Test
  public void testGetBalanceNoId() {
    CallingCardMaintenanceRequest request = new CallingCardMaintenanceRequest();
    CommonTestRoutines.createDummyUserContext(request);

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

    request.setCallingCardInfo(callingCardInfo);

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

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

    assertEquals(
        "",
        PROSPERITASGLOBAL_BASE_CALLINGCARDVALIDATOR_PERSON_ID_REQUIRED,
        response.getMessageList().get(0).getMessageInfo().getCode());
  }
コード例 #3
0
  @Test
  public void testRetrieveMorePinNumbers() {
    CallingCardMaintenanceRequest request = new CallingCardMaintenanceRequest();
    CommonTestRoutines.createDummyUserContext(request);

    CallingCardInfo callingCardInfo = new CallingCardInfo();
    callingCardInfo.setModelAction(PersistanceActionEnum.FETCH);

    request.setCallingCardInfo(callingCardInfo);

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

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

    CommonTestRoutines.assertResponse(response);

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

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

    request.setCallingCardInfo(callingCardInfo);

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

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

    CommonTestRoutines.assertResponse(response);

    // ensures the mock's assignCard was called 1 time.
    Mockito.verify(getMockCallingCardBAC()).refillCard(request);
  }