/*
 *    Copyright (C) 2016 Björn Quentin
 *    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.
 */

package de.mobilej.thinr;

import org.junit.BeforeClass;
import org.junit.Test;
import org.powermock.reflect.Whitebox;

/**
 * Tests "checkValidFunction"
 * <p>
 * Created by bjoern on 01.07.2016.
 */

public class RuntimeCheckTest {

    @BeforeClass
    public static void setup() throws Exception {
        Thinr.setRuntimeChecksEnabled(true);
    }

    @Test
    public void testAValidFunction() throws Exception {
        Object function = new ValidFunction();
        Whitebox.invokeMethod(Thinr.class, "checkValidFunction", function);
    }

    @Test
    public void testAValidFunctionWithJacocoField() throws Exception {
        Object function = new ValidJacocoFunction();
        Whitebox.invokeMethod(Thinr.class, "checkValidFunction", function);
    }

    @Test
    public void testAValidFunctionWithRetroLambdaField() throws Exception {
        Object function = new ValidRetroLambdaFunction();
        Whitebox.invokeMethod(Thinr.class, "checkValidFunction", function);
    }

    @Test
    public void testAValidFunctionWithLambdaField() throws Exception {
        Object function = new ValidLambdaFunction();
        Whitebox.invokeMethod(Thinr.class, "checkValidFunction", function);
    }

    @Test(expected = IllegalArgumentException.class)
    public void testInavlidValidFunction() throws Exception {
        Object function = new InvalidFunction();
        Whitebox.invokeMethod(Thinr.class, "checkValidFunction", function);
    }


    public static class ValidJacocoFunction {
        public Object $jacocoData;
    }

    public static class ValidRetroLambdaFunction {
        public ValidRetroLambdaFunction instance;
    }

    public static class ValidLambdaFunction {
        public ValidLambdaFunction INSTANCE;
    }

    public static class ValidFunction {
    }

    public class InvalidFunction {
    }

}

@@ -1817,32 +1817,290 @@
 nction);%0A    %7D%0A%0A
+    @Test%0A    public void testAddMethodToWhitelist() throws Exception %7B%0A        Thinr.addMethodToWhiteList(%22whitelist%22);%0A        Object function = new NewWhitelistFunction();%0A        Whitebox.invokeMethod(Thinr.class, %22checkValidFunction%22, function);%0A    %7D%0A%0A
     @Test(expect
@@ -2617,32 +2617,133 @@
 NSTANCE;%0A    %7D%0A%0A
+    public static class NewWhitelistFunction %7B%0A        public NewWhitelistFunction whitelist;%0A    %7D%0A%0A
     public stati

Add more tests