package org.ngrinder.operation;

import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.not;
import static org.junit.Assert.assertThat;

import org.junit.Test;
import org.ngrinder.AbstractNGrinderTransactionalTest;
import org.ngrinder.infra.logger.CoreLogger;
import org.ngrinder.operation.cotroller.LogMonitorController;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;

import com.google.gson.JsonElement;
import com.google.gson.JsonParser;

public class LogMonitorControllerTest extends AbstractNGrinderTransactionalTest{
	public static final Logger LOGGER = LoggerFactory.getLogger(LogMonitorControllerTest.class);
	@Autowired
	private LogMonitorController logMonitorController;
	
	@Test
	public void testLogMonitorController() {
		CoreLogger.LOGGER.info("Core Logger");
		LOGGER.debug("TEST TEST");
		sleep(3000);
		assertThat(getLastMessage(), not(containsString("TEST TEST")));
		assertThat(getLastMessage(), containsString("Core Logger"));

		logMonitorController.enableVerbose(true);
		LOGGER.debug("TEST TEST");
		sleep(3000);
		assertThat(getLastMessage(), containsString("TEST TEST"));
		
	}

	private String getLastMessage() {
		HttpEntity<String> lastLog = logMonitorController.getLastLog();
		JsonParser parser = new JsonParser();
		JsonElement parse = parser.parse(lastLog.getBody());
		String message = parse.getAsJsonObject().get("log").getAsString();
		return message;
	}
}

@@ -875,16 +875,246 @@
 ler() %7B%0A
+%09%09logMonitorController.enableVerbose(false);%0A%09%09StringBuffer buffer = new StringBuffer();%0A%09%09for (int i = 0; i %3C 100; i++) %7B%0A%09%09%09buffer.append(%22====================================%22);%0A%09%09%7D%0A%09%09CoreLogger.LOGGER.info(buffer.toString());%0A
 %09%09CoreLo

Fix test failure