Header { public String[] getBandNames() { return headerParser.getStrings(EnviConstants.HEADER_KEY_BAND_NAMES); } Header(final BufferedReader reader); ByteOrder getJavaByteOrder(); String getFileType(); int getNumSamples(); int getNumLines(); int getNumBands(); int getHeaderOffset(); int getDataType(); String getInterleave(); String getSensorType(); int getByteOrder(); EnviMapInfo getMapInfo(); EnviProjectionInfo getProjectionInfo(); String[] getBandNames(); String getDescription(); BeamProperties getBeamProperties(); String[] getWavelengths(); String[] getFWHM(); String getWavelengthsUnit(); double[] getDataOffsetValues(); double[] getDataGainValues(); Double getDataIgnoreValue(); int getNumClasses(); String[] getClassNmaes(); int[] getClassColorRGB(); static Properties loadProperties(String text); MetadataElement getAsMetadata();  }
@Test public void testParseBandNames_empty() throws IOException { final String line = "band names = {}"; final BufferedReader in = createReader(createMandatoryHeader() + line); final Header header = new Header(in); final String[] bandNames = header.getBandNames(); assertEquals(0, bandNames.length); }
@Test public void testParseBandNames_noBandnameProperty() throws IOException { final BufferedReader in = createReader(createMandatoryHeader()); final Header header = new Header(in); final String[] bandNames = header.getBandNames(); assertNotNull(bandNames); assertEquals(0, bandNames.length); }
@Test public void testParseBandNames() throws IOException { final String line = "band names = {Karl, Fritzi, Petra}"; final BufferedReader in = createReader(createMandatoryHeader() + line); final Header header = new Header(in); final String[] bandNames = header.getBandNames(); assertEquals(3, bandNames.length); assertEquals("Karl", bandNames[0]); assertEquals("Fritzi", bandNames[1]); assertEquals("Petra", bandNames[2]); }
@Test public void testParseBandNames_multipleLines() throws IOException { final String line = "band names = {Hugh, \nGrant, \nJulia, \n Roberts\n}"; final BufferedReader in = createReader(createMandatoryHeader() + line); final Header header = new Header(in); final String[] bandNames = header.getBandNames(); assertEquals(4, bandNames.length); assertEquals("Hugh", bandNames[0]); assertEquals("Grant", bandNames[1]); assertEquals("Julia", bandNames[2]); assertEquals("Roberts", bandNames[3]); }