### Question:
Info2 { public List<Image> findBootloaderImages(String hardware, String model, String key, String current) throws JSONException { JSONObject models= root.getJSONObject(hardware); JSONObject builds = models.getJSONObject(model); JSONObject versions = builds.getJSONObject("bootloader"); ArrayList<Image> acc = new ArrayList<>(); Version keyVersion = new Version(key); while(new Version(current).compareTo(keyVersion) > 0) { acc.add(0, verifyImage( hardware, model, "bootloader", current, versions.getJSONObject(current) )); current = acc.get(0).requiredBootloader; } return acc; } Info2(JSONObject root, String apiVersionStr); Image findFirmwareImage(String hardware, String model, String build); Image findFirmwareImage(String hardware, String model, String build, String version); List<Image> findBootloaderImages(String hardware, String model, String key, String current);  }### Answer:
@Test public void bootloaderMatches() throws JSONException { assertTrue(info.findBootloaderImages("0.4", "5", "0.3.3", "0.3.3").isEmpty()); }
@Test public void booloaderChain() throws JSONException { final String hardware = "0.2"; final String model = "6"; final String build = "bootloader"; List<Image> expected = Arrays.asList( new Image(hardware, model, build, "0.2.2", "bl.zip", "0.2.1", "3.5.0"), new Image(hardware, model, build, "0.3.1", "sd_bl.zip", "0.2.2", "3.5.0"), new Image(hardware, model, build, "0.3.2", "bl.zip", "0.3.1", "3.5.0"), new Image(hardware, model, build, "0.3.3", "bl.zip", "0.3.2", "3.5.0") ); assertEquals(expected, info.findBootloaderImages(hardware, model, "0.2.1", "0.3.3")); }