@Test public void GIVEN_non_null_humidity_WHEN_formatting_requested_THEN_returns_correct_percentage_value() { testee = new HumidityFormatter(0); assertEquals("0%", testee.format()); testee = new HumidityFormatter(99); assertEquals("99%", testee.format()); }
public String format() { String formatted = "--%"; if (humidityPercentage != null) { formatted = String.format(Locale.US, "%1d%%", humidityPercentage); } return formatted; }
HumidityFormatter { public String format() { String formatted = "--%"; if (humidityPercentage != null) { formatted = String.format(Locale.US, "%1d%%", humidityPercentage); } return formatted; } }
HumidityFormatter { public String format() { String formatted = "--%"; if (humidityPercentage != null) { formatted = String.format(Locale.US, "%1d%%", humidityPercentage); } return formatted; } HumidityFormatter(Integer humidityPercentage); }
HumidityFormatter { public String format() { String formatted = "--%"; if (humidityPercentage != null) { formatted = String.format(Locale.US, "%1d%%", humidityPercentage); } return formatted; } HumidityFormatter(Integer humidityPercentage); String format(); }
HumidityFormatter { public String format() { String formatted = "--%"; if (humidityPercentage != null) { formatted = String.format(Locale.US, "%1d%%", humidityPercentage); } return formatted; } HumidityFormatter(Integer humidityPercentage); String format();  }