// Path: spanners-mvc/src/main/java/org/dontpanic/spanners/springmvc/domain/Spanner.java
// public class Spanner {
// 
//     private Long id;
//     private String name;
//     private int size;
//     private String owner;
// 
//     public Long getId() {
//         return id;
//     }
// 
//     public void setId(Long id) {
//         this.id = id;
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public void setName(String name) {
//         this.name = name;
//     }
// 
//     public int getSize() {
//         return size;
//     }
// 
//     public void setSize(int size) {
//         this.size = size;
//     }
// 
//     public String getOwner() {
//         return owner;
//     }
// 
//     public void setOwner(String owner) {
//         this.owner = owner;
//     }
// }
// 
// Path: spanners-mvc/src/test/java/org/dontpanic/spanners/springmvc/stubs/SpannerAssert.java
// public static void assertSpanner(String expectedName, int expectedSize, String expectedOwner, Spanner actual) {
//     assertNotNull("Spanner is null", actual);
//     assertEquals("spanner name", expectedName, actual.getName());
//     assertEquals("spanner size", expectedSize, actual.getSize());
//     assertEquals("spanner owner", expectedOwner, actual.getOwner());
// }
// 
// Path: spanners-mvc/src/test/java/org/dontpanic/spanners/springmvc/stubs/SpannerBuilder.java
// public static SpannerBuilder aSpanner() {
// 	return new SpannerBuilder();
// }


import org.dontpanic.spanners.springmvc.domain.Spanner;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.client.RestClientTest;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.client.MockRestServiceServer;
import org.springframework.test.web.client.ResponseCreator;
import java.util.Collection;
import static org.dontpanic.spanners.springmvc.stubs.SpannerAssert.assertSpanner;
import static org.dontpanic.spanners.springmvc.stubs.SpannerBuilder.aSpanner;
import static org.hamcrest.Matchers.hasSize;
import static org.junit.Assert.assertThat;
import static org.springframework.http.HttpMethod.*;
import static org.springframework.test.web.client.match.MockRestRequestMatchers.method;
import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo;
import static org.springframework.test.web.client.response.MockRestResponseCreators.withStatus;
import static org.springframework.test.web.client.response.MockRestResponseCreators.withSuccess;

        // Check that the server received the message
        server.verify();
    }

    @Test
    public void testCreate() throws Exception {
        server.expect(requestTo("/")).andExpect(method(POST))
                .andRespond(withStatus(HttpStatus.CREATED));

        Spanner newSpanner = aSpanner().withId(null).build();
        service.create(newSpanner);

        // Check that the server received the message
        server.verify();
    }

    @Test
    public void testUpdate() throws Exception {
        server.expect(requestTo("/1")).andExpect(method(PUT))
                .andRespond(withStatus(HttpStatus.OK));

        Spanner update = aSpanner().withId(1L).build();
        service.update(update);

        // Check that the server received the message
        server.verify();
    }

    private ResponseCreator withHalJsonResponse(String fileName) {
// Path: spanners-mvc/src/main/java/org/dontpanic/spanners/springmvc/domain/Spanner.java
// public class Spanner {
// 
//     private Long id;
//     private String name;
//     private int size;
//     private String owner;
// 
//     public Long getId() {
//         return id;
//     }
// 
//     public void setId(Long id) {
//         this.id = id;
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public void setName(String name) {
//         this.name = name;
//     }
// 
//     public int getSize() {
//         return size;
//     }
// 
//     public void setSize(int size) {
//         this.size = size;
//     }
// 
//     public String getOwner() {
//         return owner;
//     }
// 
//     public void setOwner(String owner) {
//         this.owner = owner;
//     }
// }
// 
// Path: spanners-mvc/src/test/java/org/dontpanic/spanners/springmvc/stubs/SpannerAssert.java
// public static void assertSpanner(String expectedName, int expectedSize, String expectedOwner, Spanner actual) {
//     assertNotNull("Spanner is null", actual);
//     assertEquals("spanner name", expectedName, actual.getName());
//     assertEquals("spanner size", expectedSize, actual.getSize());
//     assertEquals("spanner owner", expectedOwner, actual.getOwner());
// }
// 
// Path: spanners-mvc/src/test/java/org/dontpanic/spanners/springmvc/stubs/SpannerBuilder.java
// public static SpannerBuilder aSpanner() {
// 	return new SpannerBuilder();
// }


// Path: spanners-mvc/src/test/java/org/dontpanic/spanners/springmvc/services/SpannersServiceTest.java
import org.dontpanic.spanners.springmvc.domain.Spanner;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.client.RestClientTest;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.client.MockRestServiceServer;
import org.springframework.test.web.client.ResponseCreator;
import java.util.Collection;
import static org.dontpanic.spanners.springmvc.stubs.SpannerAssert.assertSpanner;
import static org.dontpanic.spanners.springmvc.stubs.SpannerBuilder.aSpanner;
import static org.hamcrest.Matchers.hasSize;
import static org.junit.Assert.assertThat;
import static org.springframework.http.HttpMethod.*;
import static org.springframework.test.web.client.match.MockRestRequestMatchers.method;
import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo;
import static org.springframework.test.web.client.response.MockRestResponseCreators.withStatus;
import static org.springframework.test.web.client.response.MockRestResponseCreators.withSuccess;


        // Check that the server received the message
        server.verify();
    }

    @Test
    public void testCreate() throws Exception {
        server.expect(requestTo("/")).andExpect(method(POST))
                .andRespond(withStatus(HttpStatus.CREATED));

        Spanner newSpanner = aSpanner().withId(null).build();
        service.create(newSpanner);

        // Check that the server received the message
        server.verify();
    }

    @Test
    public void testUpdate() throws Exception {
        server.expect(requestTo("/1")).andExpect(method(PUT))
                .andRespond(withStatus(HttpStatus.OK));

        Spanner update = aSpanner().withId(1L).build();
        service.update(update);

        // Check that the server received the message
        server.verify();
    }

    private ResponseCreator withHalJsonResponse(String fileName) {
        Resource jsonResponse = new ClassPathResource(fileName);