### Question:
BaseUploader { public final boolean uploadGlucoseDataSets(List<GlucoseDataSet> glucoseDataSets) { if (glucoseDataSets == null) { return true; } boolean output = true; for (GlucoseDataSet glucoseDataSet : glucoseDataSets) { try { output &= doUpload(glucoseDataSet); } catch (IOException e) { log.error("Error uploading glucose data set.", e); output = false; } } return output; } BaseUploader(NightscoutPreferences preferences); final boolean uploadGlucoseDataSets(List<GlucoseDataSet> glucoseDataSets); final boolean uploadMeterRecords(List<MeterEntry> meterRecords); final boolean uploadCalRecords(List<CalibrationEntry> calRecords); final boolean uploadDeviceStatus(AbstractUploaderDevice deviceStatus); boolean uploadRecords(List<GlucoseDataSet> glucoseDataSets, List<MeterEntry> meterRecords, List<CalibrationEntry> calRecords, AbstractUploaderDevice deviceStatus);  }### Answer:
@Test public void testUploadGlucoseDataSets_Null() { try { mockUploader.uploadGlucoseDataSets(null); } catch (NullPointerException e) { fail("Shouldn't get a NPE"); } }
@Test public void testUploadGlucoseDataSets_Zero() { mockUploader.uploadGlucoseDataSets(new ArrayList<GlucoseDataSet>()); assertThat(mockUploader.glucoseDataSets, is(empty())); }
@Test public void testUploadGlucoseDataSets_One() { List<GlucoseDataSet> list = Lists.newArrayList(mockGlucoseDataSet()); mockUploader.uploadGlucoseDataSets(list); assertThat(mockUploader.glucoseDataSets, hasSize(1)); }
@Test public void testUploadGlucoseDataSets_Many() { List<GlucoseDataSet> list = Lists.newArrayList( mockGlucoseDataSet(), mockGlucoseDataSet(), mockGlucoseDataSet()); mockUploader.uploadGlucoseDataSets(list); assertThat(mockUploader.glucoseDataSets, hasSize(3)); }
@Test public void testUploadGlucoseDataSets_Exception() { try { exceptionUploader.uploadGlucoseDataSets(Lists.newArrayList(mockGlucoseDataSet())); } catch (Exception e) { fail("Shouldn't throw an exception."); } }