Adding functionality
The user interface is in place. Now, we can start adding some basic functionality. This functionality will include the code to handle the actual temperature conversion.
Temperature conversion
From the list of requirements, we can obtain this statement: When one temperature is entered in one field, the other one is automatically updated with the conversion.
Following our plan, we must implement this as a test to verify that the correct functionality is there. Our test would look something like this:
@UiThreadTest public void testFahrenheitToCelsiusConversion() { celsiusInput.clear(); fahrenheitInput.clear(); fahrenheitInput.requestFocus(); fahrenheitInput.setText("32.5"); celsiusInput.requestFocus(); double f = 32.5; double expectedC = TemperatureConverter.fahrenheitToCelsius(f); double actualC = celsiusInput.getNumber(); double delta = Math.abs(expectedC - actualC); String msg = "" + f + "F -> " + expectedC + "C but was " + actualC + "C (delta...