FirmwareBundle { public FirmwareImage getNextImage() throws OADException { if (imageCounter >= images.size() ) { throw new OADException("Firmware bundle is exhausted, all images rejected"); } FirmwareImage i = images.get(imageCounter); imageCounter++; return i; } FirmwareBundle(List<FirmwareImage> images); long version(); FirmwareImage getNextImage(); void reset();  }
@Test public void testFirmwareBundleGetNextImageManyImages() throws ImageParsingException, OADException { images.add(imageA); images.add(imageB); bundle = new FirmwareBundle(images); assertThat(bundle.getNextImage()).isEqualTo(imageA); assertThat(bundle.getNextImage()).isEqualTo(imageB); try { bundle.getNextImage(); fail("Expected OAD Exception"); } catch (OADException e) { } }
@Test public void testFirmwareBundleGetNextImageOneImage() throws ImageParsingException, OADException { images.add(imageA); bundle = new FirmwareBundle(images); assertThat(bundle.getNextImage()).isEqualTo(imageA); try { bundle.getNextImage(); fail("Expected OAD Exception"); } catch (OADException e) { } }