package com.pollistics;

import org.junit.Test;
import org.junit.runner.RunWith;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.test.context.junit4.SpringRunner;

import static org.assertj.core.api.Assertions.assertThat;

@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
public class PollisticsApplicationTests {

	@Autowired
	private TestRestTemplate restTemplate;

	@Test
	public void homeTest() {
		String body = this.restTemplate.getForObject("/", String.class);
		assertThat(body).isEqualTo("<!DOCTYPE HTML>\n" +
				"\n" +
				"<html lang=\"en\">\n" +
				"<head>\n" +
				"    <meta charset=\"UTF-8\" />\n" +
				"    <title>Pollistics</title>\n" +
				"</head>\n" +
				"<body>\n" +
				"    <p>Hello World!</p>\n" +
				"</body>\n" +
				"</html>\n");
	}

	@Test
	public void pollNameTest() {
		String body = this.restTemplate.getForObject("/polls/some-poll", String.class);
		assertThat(body).contains("some-poll");
	}

}

@@ -425,46 +425,75 @@
 org.
-assertj.core.api.Assertions.a
+hamcrest.CoreMatchers.*;%0Aimport static org.hamcrest.MatcherA
 ssert
-That
+.*
 ;%0A%0A@
@@ -677,16 +677,114 @@
 plate;%0A%0A
+    /**%0A     * Test that the poll %22Amerikaanse verkiezingen%22 is available on the homepage%0A     */%0A
 %09@Test%0A%09
@@ -896,288 +896,174 @@
 body
-).isEqualTo(%22%3C!DOCTYPE HTML%3E%5Cn%22 +%0A%09%09%09%09%22%5Cn%22 +%0A%09%09%09%09%22%3Chtml lang=%5C%22en%5C%22%3E%5Cn%22 +%0A%09%09%09%09%22%3Chead%3E%5Cn%22 +%0A%09%09%09%09%22    %3Cmeta charset=%5C%22UTF-8%5C%22 /%3E%5Cn%22 +%0A%09%09%09%09%22    %3Ctitle%3EPollistics%3C/title%3E%5Cn%22 +%0A%09%09%09%09%22%3C/head%3E%5Cn%22 +%0A%09%09%09%09%22%3Cbody%3E%5Cn%22 +%0A%09%09%09%09%22    %3Cp%3EHello World!%3C/p%3E%5Cn%22 +%0A%09%09%09%09%22%3C/body%3E%5Cn%22 +%0A%09%09%09%09%22%3C/html%3E%5Cn%22);%0A%09%7D%0A
+, containsString(%22Amerikaanse verkiezingen%22));%0A%09%7D%0A%0A    /**%0A     * This tests that /polls/ isn't reached%0A     * todo: this should test that a specific id works%0A     */
 %0A%09@T
@@ -1151,25 +1151,16 @@
 %22/polls/
-some-poll
 %22, Strin
@@ -1190,18 +1190,18 @@
 body
-).
+, 
 contains
 (%22so
@@ -1200,20 +1200,21 @@
 ains
-(%22some-poll%22
+String(%22404%22)
 );%0A%09

update tests