package com.pm.server.controller;

import java.util.Arrays;
import java.util.List;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.junit.After;
import org.junit.Before;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;

import com.pm.server.ControllerTestTemplate;
import com.pm.server.datatype.Coordinate;
import com.pm.server.datatype.CoordinateImpl;
import com.pm.server.repository.PacmanRepository;

public class PacmanControllerTest extends ControllerTestTemplate {

	@Autowired
	private PacmanRepository pacmanRepository;

	private static final List<Coordinate> randomCoordinateList = Arrays.asList(
			new CoordinateImpl(12941.49901, 39231.05893),
			new CoordinateImpl(03912.08312, 11293.34921)
	);

	private static final String BASE_MAPPING = "/pacman";

	@Autowired
	private WebApplicationContext webApplicationContext;

	private MockMvc mockMvc;

	@Before
	public void setUp() {

		mockMvc = MockMvcBuilders
				.webAppContextSetup(this.webApplicationContext)
				.build();

	}

	@After
	public void cleanUp() {

		pacmanRepository.clearPlayers();
		assert(pacmanRepository.numOfPlayers() == 0);

	}

}
@@ -28,16 +28,193 @@
 oller;%0A%0A
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;%0Aimport static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;%0A%0A
 import j
@@ -230,16 +230,16 @@
 Arrays;%0A
-
 import j
@@ -387,16 +387,39 @@
 Before;%0A
+import org.junit.Test;%0A
 import o
@@ -838,16 +838,54 @@
 ository;
+%0Aimport com.pm.server.utils.JsonUtils;
 %0A%0Apublic
@@ -1238,16 +1238,114 @@
 cman%22;%0A%0A
+%09private static final Logger log =%0A%09%09%09LogManager.getLogger(GhostControllerTest.class.getName());%0A%0A
 %09@Autowi
@@ -1684,9 +1684,486 @@
 );%0A%0A%09%7D%0A%0A
+%09@Test%0A%09public void unitTest_createPacman() throws Exception %7B%0A%0A%09%09// Given%0A%09%09final String path = pathForCreatePacman();%0A%0A%09%09Coordinate location = randomCoordinateList.get(0);%0A%09%09final String body = JsonUtils.objectToJson(location);%0A%0A%09%09// When%0A%09%09mockMvc%0A%09%09%09%09.perform((post(path))%0A%09%09%09%09%09%09.header(%22Content-Type%22, %22application/json%22)%0A%09%09%09%09%09%09.content(body)%0A%09%09%09%09)%0A%0A%09%09// Then%0A%09%09%09%09.andExpect(status().isOk());%0A%0A%09%7D%0A%0A%09private static String pathForCreatePacman() %7B%0A%09%09return BASE_MAPPING;%0A%09%7D%0A%0A
 %7D

Write smoke test for createPacman