// Path: src/main/java/spark/routematch/RouteMatch.java
// public class RouteMatch {
// 
//     private Object target;
//     private String matchUri;
//     private String requestURI;
//     private String acceptType;
//     private HttpMethod httpMethod;
// 
//     public RouteMatch(Object target, String matchUri, String requestUri, String acceptType) {
//         this(target, matchUri, requestUri, acceptType, null);
//      }
// 
//     public RouteMatch(Object target, String matchUri, String requestUri, String acceptType, HttpMethod httpMethod) {
//         super();
//         this.target = target;
//         this.matchUri = matchUri;
//         this.requestURI = requestUri;
//         this.acceptType = acceptType;
//         this.httpMethod = httpMethod;
//     }
// 
//     /**
//      * @return the accept type
//      */
//     public HttpMethod getHttpMethod() {
//         return httpMethod;
//     }
// 
//     /**
//      * @return the accept type
//      */
//     public String getAcceptType() {
//         return acceptType;
//     }
// 
//     /**
//      * @return the target
//      */
//     public Object getTarget() {
//         return target;
//     }
// 
// 
//     /**
//      * @return the matchUri
//      */
//     public String getMatchUri() {
//         return matchUri;
//     }
// 
// 
//     /**
//      * @return the requestUri
//      */
//     public String getRequestURI() {
//         return requestURI;
//     }
// 
// 
// }
// 
// Path: src/main/java/spark/Service.java
// public static Service ignite() {
//     return new Service();
// }


import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import spark.route.HttpMethod;
import spark.routematch.RouteMatch;
import spark.util.SparkTestUtil;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is;
import static spark.Service.ignite;

    @Test
    public void testStaticFileCssStyleCssWithSecond() throws Exception {
        SparkTestUtil.UrlResponse response = secondClient.doMethod("GET", "/css/style.css", null);
        Assert.assertEquals(200, response.status);
        Assert.assertEquals("Content of css file", response.body);
    }

    @Test
    public void testGetAllRoutesFromBothServices(){
        for(RouteMatch routeMatch : first.routes()){
            Assert.assertEquals(routeMatch.getAcceptType(), "*/*");
            Assert.assertEquals(routeMatch.getHttpMethod(), HttpMethod.get);
            Assert.assertEquals(routeMatch.getMatchUri(), "/hello");
            Assert.assertEquals(routeMatch.getRequestURI(), "ALL_ROUTES");
            Assert.assertThat(routeMatch.getTarget(), instanceOf(RouteImpl.class));
        }

        for(RouteMatch routeMatch : second.routes()){
            Assert.assertEquals(routeMatch.getAcceptType(), "*/*");
            Assert.assertThat(routeMatch.getHttpMethod(), instanceOf(HttpMethod.class));
            boolean isUriOnList = ("/hello/hi/uniqueforsecond").contains(routeMatch.getMatchUri());
            Assert.assertTrue(isUriOnList);
            Assert.assertEquals(routeMatch.getRequestURI(), "ALL_ROUTES");
            Assert.assertThat(routeMatch.getTarget(), instanceOf(RouteImpl.class));
        }
    }

    private static Service igniteFirstService() {

// Path: src/main/java/spark/routematch/RouteMatch.java
// public class RouteMatch {
// 
//     private Object target;
//     private String matchUri;
//     private String requestURI;
//     private String acceptType;
//     private HttpMethod httpMethod;
// 
//     public RouteMatch(Object target, String matchUri, String requestUri, String acceptType) {
//         this(target, matchUri, requestUri, acceptType, null);
//      }
// 
//     public RouteMatch(Object target, String matchUri, String requestUri, String acceptType, HttpMethod httpMethod) {
//         super();
//         this.target = target;
//         this.matchUri = matchUri;
//         this.requestURI = requestUri;
//         this.acceptType = acceptType;
//         this.httpMethod = httpMethod;
//     }
// 
//     /**
//      * @return the accept type
//      */
//     public HttpMethod getHttpMethod() {
//         return httpMethod;
//     }
// 
//     /**
//      * @return the accept type
//      */
//     public String getAcceptType() {
//         return acceptType;
//     }
// 
//     /**
//      * @return the target
//      */
//     public Object getTarget() {
//         return target;
//     }
// 
// 
//     /**
//      * @return the matchUri
//      */
//     public String getMatchUri() {
//         return matchUri;
//     }
// 
// 
//     /**
//      * @return the requestUri
//      */
//     public String getRequestURI() {
//         return requestURI;
//     }
// 
// 
// }
// 
// Path: src/main/java/spark/Service.java
// public static Service ignite() {
//     return new Service();
// }


// Path: src/test/java/spark/MultipleServicesTest.java
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import spark.route.HttpMethod;
import spark.routematch.RouteMatch;
import spark.util.SparkTestUtil;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is;
import static spark.Service.ignite;


    @Test
    public void testStaticFileCssStyleCssWithSecond() throws Exception {
        SparkTestUtil.UrlResponse response = secondClient.doMethod("GET", "/css/style.css", null);
        Assert.assertEquals(200, response.status);
        Assert.assertEquals("Content of css file", response.body);
    }

    @Test
    public void testGetAllRoutesFromBothServices(){
        for(RouteMatch routeMatch : first.routes()){
            Assert.assertEquals(routeMatch.getAcceptType(), "*/*");
            Assert.assertEquals(routeMatch.getHttpMethod(), HttpMethod.get);
            Assert.assertEquals(routeMatch.getMatchUri(), "/hello");
            Assert.assertEquals(routeMatch.getRequestURI(), "ALL_ROUTES");
            Assert.assertThat(routeMatch.getTarget(), instanceOf(RouteImpl.class));
        }

        for(RouteMatch routeMatch : second.routes()){
            Assert.assertEquals(routeMatch.getAcceptType(), "*/*");
            Assert.assertThat(routeMatch.getHttpMethod(), instanceOf(HttpMethod.class));
            boolean isUriOnList = ("/hello/hi/uniqueforsecond").contains(routeMatch.getMatchUri());
            Assert.assertTrue(isUriOnList);
            Assert.assertEquals(routeMatch.getRequestURI(), "ALL_ROUTES");
            Assert.assertThat(routeMatch.getTarget(), instanceOf(RouteImpl.class));
        }
    }

    private static Service igniteFirstService() {

        Service http = ignite(); // I give the variable the name 'http' for the code to make sense when adding routes.