BandSorter { static void sort(Band[] allBands) { Arrays.sort(allBands, createComparator()); }    }
@Test public void testSort_Without_Digits() throws Exception { List<Band> bands = new ArrayList<>(); bands.add(createBand("spec_a", 200)); bands.add(createBand("spec_b", 300)); bands.add(createBand("spec_c", 400)); bands.add(createBand("spec_d", 500)); bands.add(createBand("spec_e", 600)); bands.add(createBand("spec_f", 700)); Collections.shuffle(bands); Band[] bandsArray = bands.toArray(new Band[bands.size()]); BandSorter.sort(bandsArray); assertEquals("spec_a", bandsArray[0].getName()); assertEquals("spec_b", bandsArray[1].getName()); assertEquals("spec_c", bandsArray[2].getName()); assertEquals("spec_d", bandsArray[3].getName()); assertEquals("spec_e", bandsArray[4].getName()); assertEquals("spec_f", bandsArray[5].getName()); }
@Test public void testSort_Without_Wavelengths() throws Exception { List<Band> bands = new ArrayList<>(); bands.add(createBand("spec_1", 0)); bands.add(createBand("spec_2", 0)); bands.add(createBand("spec_3", 0)); bands.add(createBand("spec_4", 0)); bands.add(createBand("spec_5", 0)); bands.add(createBand("spec_6", 0)); Collections.shuffle(bands); Band[] bandsArray = bands.toArray(new Band[bands.size()]); BandSorter.sort(bandsArray); assertEquals("spec_1", bandsArray[0].getName()); assertEquals("spec_2", bandsArray[1].getName()); assertEquals("spec_3", bandsArray[2].getName()); assertEquals("spec_4", bandsArray[3].getName()); assertEquals("spec_5", bandsArray[4].getName()); assertEquals("spec_6", bandsArray[5].getName()); }
@Test public void testSort_Without_Wavelengths_And_Digits() throws Exception { List<Band> bands = new ArrayList<>(); bands.add(createBand("spec_a", 0)); bands.add(createBand("spec_b", 0)); bands.add(createBand("spec_c", 0)); bands.add(createBand("spec_d", 0)); bands.add(createBand("spec_e", 0)); bands.add(createBand("spec_f", 0)); Collections.shuffle(bands); Band[] bandsArray = bands.toArray(new Band[bands.size()]); BandSorter.sort(bandsArray); assertEquals("spec_a", bandsArray[0].getName()); assertEquals("spec_b", bandsArray[1].getName()); assertEquals("spec_c", bandsArray[2].getName()); assertEquals("spec_d", bandsArray[3].getName()); assertEquals("spec_e", bandsArray[4].getName()); assertEquals("spec_f", bandsArray[5].getName()); }