Esempio n. 1
0
 @Test
 public void shouldSaveProviderInfo() {
   addAndMarkForDeletion(provider);
   Provider providerReturned = allProviders.findByProviderId("P00001");
   assertNotNull(providerReturned);
   assertEquals("984567876", providerReturned.getPrimaryMobile());
 }
Esempio n. 2
0
  @Test
  public void shouldFindProviderByTertiaryMobileNumber() {
    String primaryMobile = "primary";
    String secondaryMobile = "secondary";
    String tertiaryMobile = "tertiary";
    Provider savedProvider =
        new Provider(
            "ab",
            primaryMobile,
            "districtA",
            DateTimeFormat.forPattern(DATE_TIME_FORMAT).parseDateTime("12/01/2012 10:10:10"));
    savedProvider.setSecondaryMobile(secondaryMobile);
    savedProvider.setTertiaryMobile(tertiaryMobile);

    addAndMarkForDeletion(savedProvider);

    Provider actualProvider = allProviders.findByMobileNumber(tertiaryMobile);
    assertThat(actualProvider, is(savedProvider));
  }
Esempio n. 3
0
  @Test
  public void shouldUpdateProviderIfAlreadyExists() {
    int sizeBeforeAdding = allProviders.getAll().size();

    addAndMarkForDeletion(provider);
    provider.setPrimaryMobile("modifiedNumber");
    allProviders.addOrReplace(provider);
    markForDeletion(provider);

    List<Provider> providers = allProviders.getAll();
    assertEquals(sizeBeforeAdding + 1, providers.size());
    assertEquals("modifiedNumber", allProviders.findByProviderId("P00001").getPrimaryMobile());
  }