// Path: yatspec-extensions/src/test/java/acceptance/example/production/WeatherApplication.java
// public class WeatherApplication {
//     private final Server server;
// 
//     public WeatherApplication(int port, String weatherServiceUrl) {
//         server = new Server(port);
//         server.setHandler(handlers(weatherServiceUrl));
//     }
// 
//     private HandlerList handlers(String weatherServiceUrl) {
//         HandlerList handlers = new HandlerList();
//         handlers.setHandlers(new Handler[] {requestLogHandler(), servletHandler(weatherServiceUrl)});
//         return handlers;
//     }
// 
//     private ServletHandler servletHandler(String weatherServiceUrl) {
//         ServletHandler servletHandler = new ServletHandler();
//         servletHandler.addServletWithMapping(new ServletHolder(new WeatherServlet(new OpenWeatherMapService(weatherServiceUrl))),"/weather");
//         return servletHandler;
//     }
// 
//     private RequestLogHandler requestLogHandler() {
//         NCSARequestLog requestLog = new NCSARequestLog("access.log");
//         requestLog.setAppend(true);
//         requestLog.setExtended(false);
//         requestLog.setLogTimeZone("GMT");
//         requestLog.setLogLatency(true);
//         requestLog.setRetainDays(90);
// 
//         RequestLogHandler requestLogHandler = new RequestLogHandler();
//         requestLogHandler.setRequestLog(requestLog);
//         return requestLogHandler;
//     }
// 
//     public void start() {
//         try {
//             server.start();
//         } catch (Exception e) {
//             throw new RuntimeException("Could not start the server", e);
//         }
//     }
// 
//     public void stop() {
//         try {
//             server.stop();
//         } catch (Exception e) {
//             throw new RuntimeException("Could not stop the server", e);
//         }
//     }
// 
//     public String baseUrl() {
//         return server.getURI().toString();
//     }
// }
// 
// Path: yatspec-extensions/src/main/java/io/github/theangrydev/fluentbdd/yatspec/WriteOnlyTestItems.java
// public interface WriteOnlyTestItems {
// 
//     /**
//      * @param key The name of the interesting given
//      * @param instance The interesting given instance
//      */
//     void addToGivens(String key, Object instance);
// 
//     /**
//      * @param key The name of the captured input or output
//      * @param instance The captured input or output
//      */
//     void addToCapturedInputsAndOutputs(String key, Object instance);
// }


import acceptance.example.production.WeatherApplication;
import com.github.tomakehurst.wiremock.WireMockServer;
import com.github.tomakehurst.wiremock.client.MappingBuilder;
import com.github.tomakehurst.wiremock.http.RequestListener;
import com.github.tomakehurst.wiremock.matching.RequestPatternBuilder;
import io.github.theangrydev.fluentbdd.yatspec.WriteOnlyTestItems;
import io.github.theangrydev.thinhttpclient.apache.ApacheHttpClient;
import io.github.theangrydev.thinhttpclient.api.Request;
import io.github.theangrydev.thinhttpclient.api.RequestBuilder;
import io.github.theangrydev.thinhttpclient.api.Response;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
import static io.github.theangrydev.thinhttpclient.apache.ApacheHttpClient.apacheHttpClient;
import static java.lang.String.format;
import static java.util.stream.Collectors.toList;
/*
 * Copyright 2016 Liam Williams <liam.williams@zoho.com>.
 *
 * This file is part of fluent-bdd.
 *
 * 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 acceptance.example.test;




public class TestInfrastructure {

    private static final String SYSTEM_NAME = "WeatherApplication";
    private static final WireMockServer WIREMOCK;
    private static final RequestListenerHolder REQUEST_LISTENER_HOLDER = new RequestListenerHolder();

    private final WriteOnlyTestItems writeOnlyTestItems;

    private WeatherApplication weatherApplication;

    private List<InteractionToListenFor> interactionsToListenFor = new ArrayList<>();

    static {
        WIREMOCK = new WireMockServer(wireMockConfig().port(1235));
        WIREMOCK.addMockServiceRequestListener(REQUEST_LISTENER_HOLDER);
        WIREMOCK.start();
    }

// Path: yatspec-extensions/src/test/java/acceptance/example/production/WeatherApplication.java
// public class WeatherApplication {
//     private final Server server;
// 
//     public WeatherApplication(int port, String weatherServiceUrl) {
//         server = new Server(port);
//         server.setHandler(handlers(weatherServiceUrl));
//     }
// 
//     private HandlerList handlers(String weatherServiceUrl) {
//         HandlerList handlers = new HandlerList();
//         handlers.setHandlers(new Handler[] {requestLogHandler(), servletHandler(weatherServiceUrl)});
//         return handlers;
//     }
// 
//     private ServletHandler servletHandler(String weatherServiceUrl) {
//         ServletHandler servletHandler = new ServletHandler();
//         servletHandler.addServletWithMapping(new ServletHolder(new WeatherServlet(new OpenWeatherMapService(weatherServiceUrl))),"/weather");
//         return servletHandler;
//     }
// 
//     private RequestLogHandler requestLogHandler() {
//         NCSARequestLog requestLog = new NCSARequestLog("access.log");
//         requestLog.setAppend(true);
//         requestLog.setExtended(false);
//         requestLog.setLogTimeZone("GMT");
//         requestLog.setLogLatency(true);
//         requestLog.setRetainDays(90);
// 
//         RequestLogHandler requestLogHandler = new RequestLogHandler();
//         requestLogHandler.setRequestLog(requestLog);
//         return requestLogHandler;
//     }
// 
//     public void start() {
//         try {
//             server.start();
//         } catch (Exception e) {
//             throw new RuntimeException("Could not start the server", e);
//         }
//     }
// 
//     public void stop() {
//         try {
//             server.stop();
//         } catch (Exception e) {
//             throw new RuntimeException("Could not stop the server", e);
//         }
//     }
// 
//     public String baseUrl() {
//         return server.getURI().toString();
//     }
// }
// 
// Path: yatspec-extensions/src/main/java/io/github/theangrydev/fluentbdd/yatspec/WriteOnlyTestItems.java
// public interface WriteOnlyTestItems {
// 
//     /**
//      * @param key The name of the interesting given
//      * @param instance The interesting given instance
//      */
//     void addToGivens(String key, Object instance);
// 
//     /**
//      * @param key The name of the captured input or output
//      * @param instance The captured input or output
//      */
//     void addToCapturedInputsAndOutputs(String key, Object instance);
// }


// Path: yatspec-extensions/src/test/java/acceptance/example/test/TestInfrastructure.java
import acceptance.example.production.WeatherApplication;
import com.github.tomakehurst.wiremock.WireMockServer;
import com.github.tomakehurst.wiremock.client.MappingBuilder;
import com.github.tomakehurst.wiremock.http.RequestListener;
import com.github.tomakehurst.wiremock.matching.RequestPatternBuilder;
import io.github.theangrydev.fluentbdd.yatspec.WriteOnlyTestItems;
import io.github.theangrydev.thinhttpclient.apache.ApacheHttpClient;
import io.github.theangrydev.thinhttpclient.api.Request;
import io.github.theangrydev.thinhttpclient.api.RequestBuilder;
import io.github.theangrydev.thinhttpclient.api.Response;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
import static io.github.theangrydev.thinhttpclient.apache.ApacheHttpClient.apacheHttpClient;
import static java.lang.String.format;
import static java.util.stream.Collectors.toList;

/*
 * Copyright 2016 Liam Williams <liam.williams@zoho.com>.
 *
 * This file is part of fluent-bdd.
 *
 * 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 acceptance.example.test;




public class TestInfrastructure {

    private static final String SYSTEM_NAME = "WeatherApplication";
    private static final WireMockServer WIREMOCK;
    private static final RequestListenerHolder REQUEST_LISTENER_HOLDER = new RequestListenerHolder();

    private final WriteOnlyTestItems writeOnlyTestItems;

    private WeatherApplication weatherApplication;

    private List<InteractionToListenFor> interactionsToListenFor = new ArrayList<>();

    static {
        WIREMOCK = new WireMockServer(wireMockConfig().port(1235));
        WIREMOCK.addMockServiceRequestListener(REQUEST_LISTENER_HOLDER);
        WIREMOCK.start();
    }

    public TestInfrastructure(WriteOnlyTestItems writeOnlyTestItems) {