WeatherData { public boolean checkParsable(String str) { if (str == null || str.equals("")) return false; for (int i = 0; i < str.length(); i++) { if (!Character.isDigit(str.charAt(i)) && !(str.charAt(i) == '.') && !(str.charAt(i) == '-')) { return false; } } return true; } WeatherData(LocalDateTime dateTime, String[] data); abstract String[] combineValues(); abstract Reading getReading(WeatherVar whichVariable); abstract boolean containsVar(WeatherVar variable); String rightAlign(String str, int intendedLength); boolean checkQuality(String quality); boolean checkParsable(String str); void alignCommonVariables(); String parseValue(Reading reading); static final String ALLOWEDQUALITY; public String[] dataString; }
@Test public void testCheckParsable() { assertFalse(wd.checkParsable(null)); assertFalse(wd.checkParsable("")); assertFalse(wd.checkParsable("####")); assertTrue(wd.checkParsable("-3.5")); assertTrue(wd.checkParsable("1234")); assertTrue(wd.checkParsable("3.0")); assertTrue(wd.checkParsable("012.345")); }