public void updateList(ArrayList<TownModel> patients) { int index; patientsListView.clear(); for (index = 0; index < patients.size(); index++) { if (patients.get(index).isFiltered_m()) patientsListView.add( patients.get(index).getFirstName() + " " + patients.get(index).getSurname()); } patientsListView.select(0); }
/** Rigourous Test :-) */ public void testApp() { List mockList = mock(List.class); mockList.add("one"); mockList.clear(); verify(mockList).add("one"); verify(mockList).clear(); LinkedList<String> mockString = mock(LinkedList.class); Mockito.when(mockString.get(0)).thenReturn("first"); Mockito.when(mockString.get(1)).thenThrow(new RuntimeException()); System.out.println(mockString.get(0)); System.out.println(mockString.get(99)); Mockito.verify(mockString).get(0); }