BAEL-1970 fixed formatting (use spaces instead of tabs)

This commit is contained in:
mprevisic 2019-04-10 15:28:37 +02:00
parent 2674f7abff
commit 7186d96b12
1 changed files with 33 additions and 33 deletions

View File

@ -22,49 +22,49 @@ import org.springframework.test.context.junit4.SpringRunner;
@ActiveProfiles("logback-test2")
public class LogbackMultiProfileTestLogLevelIntegrationTest {
@Autowired
private TestRestTemplate restTemplate;
@Autowired
private TestRestTemplate restTemplate;
@Rule
public OutputCapture outputCapture = new OutputCapture();
@Rule
public OutputCapture outputCapture = new OutputCapture();
private String baseUrl = "/testLogLevel";
private String baseUrl = "/testLogLevel";
@Test
public void givenErrorRootLevelAndTraceLevelForOurPackage_whenCall_thenPrintTraceLogsForOurPackage() {
ResponseEntity<String> response = restTemplate.getForEntity(baseUrl, String.class);
@Test
public void givenErrorRootLevelAndTraceLevelForOurPackage_whenCall_thenPrintTraceLogsForOurPackage() {
ResponseEntity<String> response = restTemplate.getForEntity(baseUrl, String.class);
assertThat(response.getStatusCode().value()).isEqualTo(200);
assertThatOutputContainsLogForOurPackage("TRACE");
}
assertThat(response.getStatusCode().value()).isEqualTo(200);
assertThatOutputContainsLogForOurPackage("TRACE");
}
@Test
public void givenErrorRootLevelAndTraceLevelForOurPackage_whenCall_thenNoTraceLogsForOtherPackages() {
ResponseEntity<String> response = restTemplate.getForEntity(baseUrl, String.class);
@Test
public void givenErrorRootLevelAndTraceLevelForOurPackage_whenCall_thenNoTraceLogsForOtherPackages() {
ResponseEntity<String> response = restTemplate.getForEntity(baseUrl, String.class);
assertThat(response.getStatusCode().value()).isEqualTo(200);
assertThatOutputDoesntContainLogForOtherPackages("TRACE");
}
assertThat(response.getStatusCode().value()).isEqualTo(200);
assertThatOutputDoesntContainLogForOtherPackages("TRACE");
}
@Test
public void givenErrorRootLevelAndTraceLevelForOurPackage_whenCall_thenPrintErrorLogs() {
ResponseEntity<String> response = restTemplate.getForEntity(baseUrl, String.class);
@Test
public void givenErrorRootLevelAndTraceLevelForOurPackage_whenCall_thenPrintErrorLogs() {
ResponseEntity<String> response = restTemplate.getForEntity(baseUrl, String.class);
assertThat(response.getStatusCode().value()).isEqualTo(200);
assertThatOutputContainsLogForOurPackage("ERROR");
assertThatOutputContainsLogForOtherPackages("ERROR");
}
assertThat(response.getStatusCode().value()).isEqualTo(200);
assertThatOutputContainsLogForOurPackage("ERROR");
assertThatOutputContainsLogForOtherPackages("ERROR");
}
private void assertThatOutputContainsLogForOurPackage(String level) {
assertThat(outputCapture.toString()).containsPattern("TestLogLevelController.*" + level + ".*");
}
private void assertThatOutputContainsLogForOurPackage(String level) {
assertThat(outputCapture.toString()).containsPattern("TestLogLevelController.*" + level + ".*");
}
private void assertThatOutputDoesntContainLogForOtherPackages(String level) {
assertThat(outputCapture.toString().replaceAll("(?m)^.*TestLogLevelController.*$", "")).doesNotContain(level);
}
private void assertThatOutputDoesntContainLogForOtherPackages(String level) {
assertThat(outputCapture.toString().replaceAll("(?m)^.*TestLogLevelController.*$", "")).doesNotContain(level);
}
private void assertThatOutputContainsLogForOtherPackages(String level) {
assertThat(outputCapture.toString().replaceAll("(?m)^.*TestLogLevelController.*$", "")).contains(level);
}
private void assertThatOutputContainsLogForOtherPackages(String level) {
assertThat(outputCapture.toString().replaceAll("(?m)^.*TestLogLevelController.*$", "")).contains(level);
}
}