### Question:
EurekaApplications { public List<Application> getRegistered() { Applications applications = eurekaClient.getApplications(); if (applications == null) { return Collections.emptyList(); } return applications.getRegisteredApplications(); }  List<Application> getRegistered();  }### Answer:
@Test void givenEurekaClient_whenRetrieveRegisteredApps_thenReturnApps() { EurekaApplications retrieval = new EurekaApplications(eurekaClient); Applications applications = mock(Applications.class); List<Application> applicationList = new ArrayList<>(); applicationList.add(mock(Application.class)); Mockito.when(eurekaClient.getApplications()).thenReturn(applications); Mockito.when(eurekaClient.getApplications().getRegisteredApplications()).thenReturn(applicationList); List<Application> registeredApps = retrieval.getRegistered(); assertFalse(registeredApps.isEmpty()); }