### Question:
Scheduler { public List<Entry> list() { List<String> attributes = new ArrayList<>(); attributes.add("id"); attributes.add("name"); attributes.add("status"); attributes.add("params"); ScanResult result = dynamoDB.scan(Prodigy.configuration().scheduler(), attributes); List<Entry> entries = new ArrayList<>(); result.getItems().forEach(i -> entries.add( new Entry(i.get("id").getS(), i.get("name").getS(), i.get("status").getS(), i.get("params").getS()))); return entries; } Scheduler();  Scheduler(AmazonDynamoDB dynamoDB); boolean schedule(Fault fault); boolean unschedule(String id); Entry get(String id); List<Entry> list();  }### Answer:
@Test @SuppressWarnings("unchecked") public void testList() { Configuration configuration = new Configuration("", ""); Prodigy.configuration(configuration); AmazonDynamoDB dynamoDB = mock(AmazonDynamoDB.class); ScanResult result = new ScanResult(); result.setItems(new ArrayList<>()); doReturn(result).when(dynamoDB).scan(anyString(), any(List.class)); Scheduler scheduler = new Scheduler(dynamoDB); List<Entry> entries = scheduler.list(); assertTrue(entries.isEmpty()); dynamoDB = mock(AmazonDynamoDB.class); result = new ScanResult(); List<Map<String, AttributeValue>> items = new ArrayList<>(); Map<String, AttributeValue> item = new HashMap<>(); item.put("id", new AttributeValue("fault-id-3")); item.put("name", new AttributeValue("fault-3")); item.put("status", new AttributeValue("INACTIVE")); item.put("params", new AttributeValue("{}")); items.add(item); result.setItems(items); doReturn(result).when(dynamoDB).scan(anyString(), any(List.class)); scheduler = new Scheduler(dynamoDB); entries = scheduler.list(); assertThat(entries.size(), is(1)); Entry entry = entries.get(0); assertThat(entry.getId(), is("fault-id-3")); assertThat(entry.getName(), is("fault-3")); assertThat(entry.getStatus(), is("INACTIVE")); assertThat(entry.getParams(), is("{}")); }