Commit 724be85b authored by Phillip Webb's avatar Phillip Webb

Polish

parent 1eab67c3
...@@ -121,7 +121,8 @@ public class LoggersMvcEndpointTests { ...@@ -121,7 +121,8 @@ public class LoggersMvcEndpointTests {
@Test @Test
public void getLoggersRootWhenDisabledShouldReturnNotFound() throws Exception { public void getLoggersRootWhenDisabledShouldReturnNotFound() throws Exception {
this.context.getBean(LoggersEndpoint.class).setEnabled(false); this.context.getBean(LoggersEndpoint.class).setEnabled(false);
this.mvc.perform(get("/application/loggers/ROOT")).andExpect(status().isNotFound()); this.mvc.perform(get("/application/loggers/ROOT"))
.andExpect(status().isNotFound());
} }
@Test @Test
...@@ -147,8 +148,10 @@ public class LoggersMvcEndpointTests { ...@@ -147,8 +148,10 @@ public class LoggersMvcEndpointTests {
@Test @Test
public void setLoggerUsingApplicationJsonShouldSetLogLevel() throws Exception { public void setLoggerUsingApplicationJsonShouldSetLogLevel() throws Exception {
this.mvc.perform(post("/application/loggers/ROOT").contentType(MediaType.APPLICATION_JSON) this.mvc.perform(
.content("{\"configuredLevel\":\"debug\"}")).andExpect(status().isOk()); post("/application/loggers/ROOT").contentType(MediaType.APPLICATION_JSON)
.content("{\"configuredLevel\":\"debug\"}"))
.andExpect(status().isOk());
verify(this.loggingSystem).setLogLevel("ROOT", LogLevel.DEBUG); verify(this.loggingSystem).setLogLevel("ROOT", LogLevel.DEBUG);
} }
...@@ -163,16 +166,18 @@ public class LoggersMvcEndpointTests { ...@@ -163,16 +166,18 @@ public class LoggersMvcEndpointTests {
@Test @Test
public void setLoggerWhenDisabledShouldReturnNotFound() throws Exception { public void setLoggerWhenDisabledShouldReturnNotFound() throws Exception {
this.context.getBean(LoggersEndpoint.class).setEnabled(false); this.context.getBean(LoggersEndpoint.class).setEnabled(false);
this.mvc.perform(post("/application/loggers/ROOT").contentType(MediaType.APPLICATION_JSON) this.mvc.perform(
.content("{\"configuredLevel\":\"DEBUG\"}")) post("/application/loggers/ROOT").contentType(MediaType.APPLICATION_JSON)
.content("{\"configuredLevel\":\"DEBUG\"}"))
.andExpect(status().isNotFound()); .andExpect(status().isNotFound());
verifyZeroInteractions(this.loggingSystem); verifyZeroInteractions(this.loggingSystem);
} }
@Test @Test
public void setLoggerWithWrongLogLevel() throws Exception { public void setLoggerWithWrongLogLevel() throws Exception {
this.mvc.perform(post("/application/loggers/ROOT").contentType(MediaType.APPLICATION_JSON) this.mvc.perform(
.content("{\"configuredLevel\":\"other\"}")) post("/application/loggers/ROOT").contentType(MediaType.APPLICATION_JSON)
.content("{\"configuredLevel\":\"other\"}"))
.andExpect(status().is4xxClientError()); .andExpect(status().is4xxClientError());
verifyZeroInteractions(this.loggingSystem); verifyZeroInteractions(this.loggingSystem);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment