daily pastebin goal
78%
SHARE
TWEET

Untitled

a guest Jan 13th, 2018 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2.  * @author Emily
  3.  * @created 13. apr. 2011
  4.  */
  5. @RunWith(Parameterized.class)
  6. public class PricesTest {
  7.     @Parameters
  8.     public static Collection<Object[]> data() {
  9.         return Arrays.asList(new Object[][] { {1d, 1d }, {1.1, 1d }, {1.24, 1d }, {1.25, 1.5 }, {1.3, 1.5 }, {1.44, 1.5 }, {1.45, 1.5 },
  10.                 {1.49, 1.5 }, {1.5, 1.5 }, {1.6, 1.5 }, {1.7, 1.5 }, {1.75, 2d } });
  11.     }
  12.  
  13.     private final double value, expected;
  14.  
  15.     public PricesTest(double value, double expected) {
  16.         super();
  17.         this.value = value;
  18.         this.expected = expected;
  19.     }
  20.  
  21.     @Test
  22.     public void test() {
  23.         Assert.assertEquals(String.format("Incorrect rounding of %.2f", value), expected, Prices.nearestHalf(value), 0d);
  24.     }
  25.  
  26. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top