package hello;

import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertThat;

import java.net.URL;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.IntegrationTest;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.boot.test.TestRestTemplate;
import org.springframework.http.ResponseEntity;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.web.client.RestTemplate;

import types.UserInfo;
import voterAccess.Application;

@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = Application.class)
@WebAppConfiguration
@IntegrationTest({"server.port=0"})
public class MainControllerTest {

    @Value("${local.server.port}")
    private int port;

    private URL base;
	private RestTemplate template;

	@Before
	public void setUp() throws Exception {
		this.base = new URL("http://localhost:" + port + "/");
		template = new TestRestTemplate();
	}

	@Test
	public void getLanding() throws Exception {
		String userURI = base.toString() + "/user";  
		ResponseEntity<String> response = template.getForEntity(base.toString(), String.class);
		assertThat(response.getBody(), equalTo("User Management Service"));
	}
	
	@Test
	public void getUser() throws Exception {
		String userURI = base.toString() + "/user";  
		ResponseEntity<String> response = template.getForEntity(userURI, String.class);
		UserInfo expected = new UserInfo("pepe",0);
	}

}
@@ -1397,19 +1397,19 @@
 esponse.
-get
+has
 Body(), 
@@ -1420,33 +1420,12 @@
 lTo(
-%22User Management Service%22
+true
 ));%0A
@@ -1535,38 +1535,40 @@
 %09ResponseEntity%3C
-String
+UserInfo
 %3E response = tem
@@ -1595,22 +1595,24 @@
 serURI, 
-String
+UserInfo
 .class);
@@ -1652,15 +1652,96 @@
 fo(%22
-pepe%22,0
+David%22,%221234546789J%22,%22uo212486%22, %22123A%22);%0A%09%09assertThat(response.hasBody(), equalTo(true)
 );%0A%09

FIX test