### Question:
CustomerResource { public List<CustomerDto> getAllCustomers() { return customers; } CustomerResource(List<CustomerDto> customers); List<CustomerDto> getAllCustomers(); void save(CustomerDto customer); void delete(String customerId);  }### Answer:
@Test public void shouldGetAllCustomers() { CustomerDto customer = new CustomerDto("1", "Melody", "Yates"); List<CustomerDto> customers = new ArrayList<>(); customers.add(customer); CustomerResource customerResource = new CustomerResource(customers); List<CustomerDto> allCustomers = customerResource.getAllCustomers(); assertEquals(1, allCustomers.size()); assertEquals("1", allCustomers.get(0).getId()); assertEquals("Melody", allCustomers.get(0).getFirstName()); assertEquals("Yates", allCustomers.get(0).getLastName()); }
@Test public void shouldGetAllCustomers() { var customers = List.of(new CustomerDto("1", "Melody", "Yates")); var customerResource = new CustomerResource(customers); var allCustomers = customerResource.getAllCustomers(); assertEquals(1, allCustomers.size()); assertEquals("1", allCustomers.get(0).getId()); assertEquals("Melody", allCustomers.get(0).getFirstName()); assertEquals("Yates", allCustomers.get(0).getLastName()); }
@Test public void shouldGetAllCustomers() { CustomerDto customer = new CustomerDto("1", "Melody", "Yates"); List<CustomerDto> customers = new ArrayList<>(); customers.add(customer); CustomerResource customerResource = new CustomerResource(customers); List<CustomerDto> allCustomers = customerResource.getAllCustomers(); assertEquals(allCustomers.size(), 1); assertEquals(allCustomers.get(0).getId(), "1"); assertEquals(allCustomers.get(0).getFirstName(), "Melody"); assertEquals(allCustomers.get(0).getLastName(), "Yates"); }