// Path: app/src/main/java/com/waynedgrant/cirrus/measures/Rainfall.java
// public class Rainfall {
//     private BigDecimal millimetres;
//     private BigDecimal inches;
// 
//     public Rainfall(BigDecimal millimetres) {
//         this.millimetres = millimetres;
//         this.inches = this.millimetres.multiply(new BigDecimal("1").divide(new BigDecimal("25.4"), DECIMAL32));
//     }
// 
//     public BigDecimal getValue(RainfallUnit unit) {
//         BigDecimal value = null;
// 
//         switch (unit) {
//             case MILLIMETRES:
//                 value = millimetres;
//                 break;
//             case INCHES:
//                 value = inches;
//                 break;
//         }
// 
//         return value;
//     }
// }
// 
// Path: app/src/main/java/com/waynedgrant/cirrus/units/RainfallUnit.java
// public enum RainfallUnit {
//     INCHES("Inches (in)"),
//     MILLIMETRES("Millimetres (mm)");
// 
//     private String description;
// 
//     RainfallUnit(String description) {
//         this.description = description;
//     }
// 
//     public String toString() {
//         return description;
//     }
// }


import com.waynedgrant.cirrus.measures.Rainfall;
import com.waynedgrant.cirrus.units.RainfallUnit;
import org.junit.Test;
import java.math.BigDecimal;
import static junit.framework.Assert.assertEquals;
package com.waynedgrant.cirrus.presentation.formatters;





public class TestRainfallFormatter {
    private RainfallFormatter testee;

    @Test
    public void GIVEN_null_rainfall_WHEN_millmetres_formatting_requested_THEN_returns_blank_millmetres_value() {
        testee = new RainfallFormatter(null);
        assertEquals("-.-- mm", testee.format(RainfallUnit.MILLIMETRES));
    }

    @Test
    public void GIVEN_null_rainfall_WHEN_inches_formatting_requested_THEN_returns_blank_inches_value() {
        testee = new RainfallFormatter(null);
        assertEquals("-.-- in", testee.format(RainfallUnit.INCHES));
    }

    @Test
    public void GIVEN_non_null_rainfall_WHEN_millmetres_formatting_requested_THEN_returns_millmetres_value_to_two_digits() {
        testee = new RainfallFormatter(new Rainfall(new BigDecimal("5.666")));
        assertEquals("5.67 mm", testee.format(RainfallUnit.MILLIMETRES));

        testee = new RainfallFormatter(new Rainfall(new BigDecimal("0")));
        assertEquals("0.00 mm", testee.format(RainfallUnit.MILLIMETRES));

        testee = new RainfallFormatter(new Rainfall(new BigDecimal("0.001")));
        assertEquals("0.00 mm", testee.format(RainfallUnit.MILLIMETRES));

// Path: app/src/main/java/com/waynedgrant/cirrus/measures/Rainfall.java
// public class Rainfall {
//     private BigDecimal millimetres;
//     private BigDecimal inches;
// 
//     public Rainfall(BigDecimal millimetres) {
//         this.millimetres = millimetres;
//         this.inches = this.millimetres.multiply(new BigDecimal("1").divide(new BigDecimal("25.4"), DECIMAL32));
//     }
// 
//     public BigDecimal getValue(RainfallUnit unit) {
//         BigDecimal value = null;
// 
//         switch (unit) {
//             case MILLIMETRES:
//                 value = millimetres;
//                 break;
//             case INCHES:
//                 value = inches;
//                 break;
//         }
// 
//         return value;
//     }
// }
// 
// Path: app/src/main/java/com/waynedgrant/cirrus/units/RainfallUnit.java
// public enum RainfallUnit {
//     INCHES("Inches (in)"),
//     MILLIMETRES("Millimetres (mm)");
// 
//     private String description;
// 
//     RainfallUnit(String description) {
//         this.description = description;
//     }
// 
//     public String toString() {
//         return description;
//     }
// }


// Path: app/src/test/java/com/waynedgrant/cirrus/presentation/formatters/TestRainfallFormatter.java
import com.waynedgrant.cirrus.measures.Rainfall;
import com.waynedgrant.cirrus.units.RainfallUnit;
import org.junit.Test;
import java.math.BigDecimal;
import static junit.framework.Assert.assertEquals;

package com.waynedgrant.cirrus.presentation.formatters;





public class TestRainfallFormatter {
    private RainfallFormatter testee;

    @Test
    public void GIVEN_null_rainfall_WHEN_millmetres_formatting_requested_THEN_returns_blank_millmetres_value() {
        testee = new RainfallFormatter(null);
        assertEquals("-.-- mm", testee.format(RainfallUnit.MILLIMETRES));
    }

    @Test
    public void GIVEN_null_rainfall_WHEN_inches_formatting_requested_THEN_returns_blank_inches_value() {
        testee = new RainfallFormatter(null);
        assertEquals("-.-- in", testee.format(RainfallUnit.INCHES));
    }

    @Test
    public void GIVEN_non_null_rainfall_WHEN_millmetres_formatting_requested_THEN_returns_millmetres_value_to_two_digits() {
        testee = new RainfallFormatter(new Rainfall(new BigDecimal("5.666")));
        assertEquals("5.67 mm", testee.format(RainfallUnit.MILLIMETRES));

        testee = new RainfallFormatter(new Rainfall(new BigDecimal("0")));
        assertEquals("0.00 mm", testee.format(RainfallUnit.MILLIMETRES));

        testee = new RainfallFormatter(new Rainfall(new BigDecimal("0.001")));
        assertEquals("0.00 mm", testee.format(RainfallUnit.MILLIMETRES));

        testee = new RainfallFormatter(new Rainfall(new BigDecimal("5.655")));