/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package nl.fontys.sofa.limo.domain.value;

import java.util.Random;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;

/**
 *
 * @author Ben
 */
public class RangeValueTest {
    
    public RangeValueTest() {
    }
    
    @BeforeClass
    public static void setUpClass() {
    }
    
    @AfterClass
    public static void tearDownClass() {
    }
    
    @Before
    public void setUp() {
    }
    
    @After
    public void tearDown() {
    }

    /**
     * Test of getValue method, of class RangeValue.
     * initiating RangeValue w/ no params takes min=0, max=1 by default.
     */
    @Test
    public void testGetValue_no_params() {
        System.out.println("getValue");
        RangeValue instance = new RangeValue();
        assertTrue("Value should be smaller or equal than 1",instance.getValue()<=1);
        assertTrue("Value should be greater or equal to 0",instance.getValue()>=0);
    }
    /**
     * Test 10 times w/ random max. values whether generated values fall within the range.
     */
    @Test
    public void testGetValue_max_val() {
        System.out.println("getValue");
        Random rand = new Random(20);
        double max;
        for (int i = 0; i < 10; i++) {
            max = rand.nextDouble();
            RangeValue instance = new RangeValue(max);
            assertTrue("Value should be smaller or equal than "+max,instance.getValue()<=max);
            assertTrue("Value should be greater or equal to 0",instance.getValue()>=0);
        }
    }


    /**
     * Test of getMin method, of class RangeValue.
     */
    @Test
    public void testGetMin() {
        System.out.println("getMin");
        RangeValue instance = new RangeValue();
        double expResult = 0.0;
        double result = instance.getMin();
        assertEquals(expResult, result, 0.0);
        // TODO review the generated test code and remove the default call to fail.
        fail("The test case is a prototype.");
    }

    /**
     * Test of getMax method, of class RangeValue.
     */
    @Test
    public void testGetMax() {
        System.out.println("getMax");
        RangeValue instance = new RangeValue();
        double expResult = 0.0;
        double result = instance.getMax();
        assertEquals(expResult, result, 0.0);
        // TODO review the generated test code and remove the default call to fail.
        fail("The test case is a prototype.");
    }
    
}

@@ -1351,24 +1351,92 @@
 the range.%0D%0A
+     * initiating RangeValue w/ only max range specified, so min=0%0D%0A
      */%0D%0A   
@@ -2140,253 +2140,82 @@
     
-double expResult = 0.0;%0D%0A        double result = instance.getMin();%0D%0A        assertEquals(expResult, result, 0.0);%0D%0A        // TODO review the generated test code and remove the default c
+assertEquals(%22Min should be equ
 al
-l
  to 
-fail.%0D%0A        fail(%22The test case is a prototype.%22
+0.00%22,0.00,instance.getMin(),0.000001
 );%0D%0A
@@ -2386,32 +2386,24 @@
      Ran
-geValue instance
+dom rand
  = new R
@@ -2400,32 +2400,30 @@
 nd = new Ran
-geValue(
+dom(20
 );%0D%0A        
@@ -2426,255 +2426,239 @@
     
-double expResult = 0.0;%0D%0A        double result = instance.getMax();%0D%0A        assertEquals(expResult, result, 0.0);%0D%0A        // TODO review the generated test code and remove the default call to fail.%0D%0A        fail(%22The test case is a prototype.%22);
+for (int i = 0; i %3C 10; i++) %7B%0D%0A            double max = rand.nextDouble();%0D%0A            RangeValue instance = new RangeValue(max);%0D%0A            assertEquals(%22Max should be equal to %22+max,max,instance.getMax(),0.000001);%0D%0A        %7D
 %0D%0A  

range value test completed