package io.induct.yle;

import com.google.inject.Guice;
import com.google.inject.Injector;
import io.induct.daniel.DanielModule;
import io.induct.yle.ioc.YleApiModule;
import org.junit.BeforeClass;

import java.io.ByteArrayInputStream;
import java.io.InputStream;

/**
 * @since 2015-05-09
 */
public abstract class YleApiTestingBase {

    protected static Injector injector;

    @BeforeClass
    public static void preTestingSetUp() throws Exception {
        injector = Guice.createInjector(
                new DanielModule(),
                new YleApiModule());
    }

    protected InputStream asStream(String s) {
        return new ByteArrayInputStream(s.getBytes());
    }
}

@@ -178,27 +178,92 @@
 g.junit.
-BeforeClass
+AfterClass;%0Aimport org.junit.BeforeClass;%0Aimport sun.net.www.http.HttpClient
 ;%0A%0Aimpor
@@ -634,16 +634,174 @@
 %0A    %7D%0A%0A
+    @AfterClass%0A    public static void postTestingSetup() throws Exception %7B%0A        ((AutoCloseable) injector.getInstance(HttpClient.class)).close();%0A    %7D%0A%0A
     prot

Clean up HttpClient after tests.