congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
ContactsLocalGateway
Code IndexAdd Tabnine to your IDE (free)

How to use
ContactsLocalGateway
in
me.panavtec.cleancontacts.domain.model

Best Java code snippets using me.panavtec.cleancontacts.domain.model.ContactsLocalGateway (Showing top 9 results out of 315)

origin: PaNaVTEC/Clean-Contacts

 @Override public List<Contact> obtain() {
  return localGateway.obtainContacts();
 }
};
origin: PaNaVTEC/Clean-Contacts

 @Override public void store(List<Contact> contacts) {
  localGateway.persist(contacts);
 }
};
origin: PaNaVTEC/Clean-Contacts

@Test public void update_cache_when_hit_network() throws Exception {
 when(localGateway.obtainContacts()).thenReturn(EMPTY_LIST);
 when(networkGateway.obtainContacts()).thenReturn(CONTACTS);
 interactor.call();
 verify(localGateway).persist(CONTACTS);
}
origin: PaNaVTEC/Clean-Contacts

 @Override public InteractorResponse<Contact> call() {
  try {
   return new InteractorResponse<>(localGateway.obtain(contactMd5));
  } catch (LocalException e) {
   return new InteractorResponse<>(new GetContactError());
  }
 }
}
origin: PaNaVTEC/Clean-Contacts

@Test public void hit_network_when_local_is_empty() {
 when(localGateway.obtainContacts()).thenReturn(EMPTY_LIST);
 interactor.call();
 verify(networkGateway).obtainContacts();
}
origin: PaNaVTEC/Clean-Contacts

@Test public void return_local_contacts_when_local_storage_is_populated() {
 when(localGateway.obtainContacts()).thenReturn(CONTACTS);
 InteractorResponse<List<Contact>> response = interactor.call();
 assertThatResponseHasResult(response);
}
origin: PaNaVTEC/Clean-Contacts

@Test public void return_networks_contacts_when_network_success() {
 when(localGateway.obtainContacts()).thenReturn(EMPTY_LIST);
 when(networkGateway.obtainContacts()).thenReturn(CONTACTS);
 InteractorResponse<List<Contact>> response = interactor.call();
 assertThatResponseHasResult(response);
}
origin: PaNaVTEC/Clean-Contacts

@Test public void hit_network_when_local_fails() {
 when(localGateway.obtainContacts()).thenThrow(new LocalException());
 interactor.call();
 verify(networkGateway).obtainContacts();
}
origin: PaNaVTEC/Clean-Contacts

@Test public void return_an_error_when_network_fails() {
 when(localGateway.obtainContacts()).thenReturn(EMPTY_LIST);
 when(networkGateway.obtainContacts()).thenThrow(new NetworkException());
 InteractorResponse<List<Contact>> result = interactor.call();
 assertThatResponseHasError(result);
}
me.panavtec.cleancontacts.domain.modelContactsLocalGateway

Most used methods

  • obtainContacts
  • persist
  • obtain

Popular in Java

  • Making http requests using okhttp
  • setRequestProperty (URLConnection)
  • runOnUiThread (Activity)
  • getResourceAsStream (ClassLoader)
  • PrintWriter (java.io)
    Wraps either an existing OutputStream or an existing Writerand provides convenience methods for prin
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • Properties (java.util)
    A Properties object is a Hashtable where the keys and values must be Strings. Each property can have
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • JFrame (javax.swing)
  • 21 Best IntelliJ Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now