/*
 * Copyright 2017 ImpactDevelopment
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import clientapi.util.annotation.Label;
import clientapi.value.IValue;
import clientapi.value.annotation.BooleanValue;
import clientapi.value.annotation.NumberValue;
import clientapi.value.holder.ValueHolder;
import org.junit.Before;
import org.junit.Test;

import static org.junit.Assert.*;

/**
 * @author Brady
 * @since 9/11/2017 11:24 AM
 */
public class ValueTest {

    private TestHolder holder;

    @Before
    public void before() {
        holder = new TestHolder();
    }

    @Test
    public void test() {
        assertEquals("Test ValueHolder should have exactly 1 value", holder.getValues().size(), 1);

        IValue parent;
        assertNotNull("IValue with a valid ID should evaluate to non null", (parent = holder.getValue("boolean_value")));
        assertEquals("BooleanValue should resolve to false if undefined", parent.getValue(), false);
        assertEquals("Test BooleanValue should have exactly 1 child value", parent.getValues().size(), 1);

        IValue child;
        assertNotNull("Child value shouldn't be null", (child = parent.getValues().get(0)));
        assertNotNull("Child value should have a non-null parent", child.getParent());
        assertEquals("Child value's parent ID should match the Test BooleanValue id", child.getParent(), parent.getID());
        assertEquals("Child value shouldn't have any children", child.getValues().size(), 0);
        assertEquals("Child value's value should be equal to its field value", child.getValue(), 5);
    }

    private class TestHolder extends ValueHolder {

        //@formatter:off

        @Label(name = "Boolean Value", id = "boolean_value", description = "An example boolean value")
        @BooleanValue
        private boolean bool;

            @Label(name = "Child Value", parent = "boolean_value", id = "child_value", description = "An example child value")
            @NumberValue(min = 0, max = 10)
            private int child = 5;

        //@formatter:on
    }
}

@@ -1111,12 +1111,22 @@
 oid 
-test
+valueDiscovery
 () %7B
@@ -1229,32 +1229,8 @@
  1);
-%0A%0A        IValue parent;
 %0A   
@@ -1302,17 +1302,116 @@
  null%22, 
-(
+holder.getValue(%22boolean_value%22));%0A    %7D%0A%0A    @Test%0A    public void booleanValue() %7B%0A        IValue 
 parent =
@@ -1443,18 +1443,16 @@
 _value%22)
-))
 ;%0A      
@@ -1657,30 +1657,164 @@
 1);%0A
-%0A        IValue child;
+    %7D%0A%0A    @Test%0A    public void childValue() %7B%0A        IValue parent = holder.getValue(%22boolean_value%22);%0A        IValue child = parent.getValues().get(0);%0A
 %0A   
@@ -1869,43 +1869,13 @@
 l%22, 
-(
 child
- = parent.getValues().get(0))
 );%0A 
@@ -2338,32 +2338,33 @@
 er %7B%0A%0A        //
+ 
 @formatter:off%0A%0A
@@ -2736,16 +2736,17 @@
       //
+ 
 @formatt

Separated the ValueTest tests