package nl.ulso.sprox.json.osgi;

import nl.ulso.sprox.json.JsonValueParserWrapper;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.ops4j.pax.exam.Configuration;
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.junit.PaxExam;
import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
import org.ops4j.pax.exam.spi.reactors.PerClass;

import static java.lang.Class.forName;
import static java.lang.Integer.parseInt;
import static nl.ulso.sprox.json.JsonValueParserWrapper.withJsonNull;
import static org.ops4j.pax.exam.CoreOptions.*;

@RunWith(PaxExam.class)
@ExamReactorStrategy(PerClass.class)
public class OsgiBundleTest {

    @Configuration
    public Option[] config() {
        return options(
                bundle("reference:file:target/classes"), // Add the compiler output as a bundle
                mavenBundle("javax.json", "javax.json-api", "1.0"),
                mavenBundle("nl.ulso.sprox", "sprox", "3.1.3"),
                junitBundles()
        );
    }

    @Test
    public void testCreateJsonXmlInputFactory() throws Exception {
        forName("nl.ulso.sprox.json.JsonXmlInputFactory");
    }

    @Test
    public void testJsonXmlConstants() throws Exception {
        forName("nl.ulso.sprox.json.JsonXmlConstants");
    }

    @Test
    public void testJsonValueParserWrapper() throws Exception {
        forName("nl.ulso.sprox.json.JsonValueParserWrapper");
        withJsonNull(::parseInt);
    }
}

@@ -363,159 +363,8 @@
 s;%0A%0A
-import static java.lang.Class.forName;%0Aimport static java.lang.Integer.parseInt;%0Aimport static nl.ulso.sprox.json.JsonValueParserWrapper.withJsonNull;%0A
 impo
@@ -928,32 +928,38 @@
 ption %7B%0A        
+Class.
 forName(%22nl.ulso
@@ -989,24 +989,24 @@
 tFactory%22);%0A
-
     %7D%0A%0A    @
@@ -1068,32 +1068,38 @@
 ption %7B%0A        
+Class.
 forName(%22nl.ulso
@@ -1219,16 +1219,22 @@
         
+Class.
 forName(
@@ -1287,16 +1287,39 @@
         
+JsonValueParserWrapper.
 withJson
@@ -1323,16 +1323,23 @@
 sonNull(
+Integer
 ::parseI

Fix broken test. (After license change. Weird IntelliJ behavior...)