Revert "Test: use System.lineSeperator instead of `\n`"

The MockTerminal used in tests uses \n always and the reverted commit re-introduced the bug which
had been fixed earlier.

Original commit: elastic/x-pack-elasticsearch@09b93b5565
This commit is contained in:
jaymode 2017-06-19 12:05:44 -06:00
parent 168b566844
commit 7cb0dbe1e6
1 changed files with 4 additions and 3 deletions

View File

@ -16,6 +16,7 @@ import org.elasticsearch.common.Strings;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.env.Environment;
import org.elasticsearch.xpack.security.authz.RoleDescriptor;
import org.elasticsearch.xpack.security.authz.permission.FieldPermissions;
import java.io.FileNotFoundException;
import java.nio.file.Files;
@ -75,12 +76,12 @@ public class ESNativeRealmMigrateToolTests extends CommandTestCase {
}
terminalLogger.log(Level.ERROR, "logging an error");
assertEquals("logging an error" + System.lineSeparator(), terminal.getOutput());
assertEquals("logging an error\n", terminal.getOutput());
terminal.reset();
assertThat(terminal.getOutput(), isEmptyString());
terminalLogger.log(Level.FATAL, "logging a fatal message");
assertEquals("logging a fatal message" + System.lineSeparator(), terminal.getOutput());
assertEquals("logging a fatal message\n", terminal.getOutput());
terminal.reset();
assertThat(terminal.getOutput(), isEmptyString());
@ -90,7 +91,7 @@ public class ESNativeRealmMigrateToolTests extends CommandTestCase {
loggingLevels.remove(Level.OFF);
for (Level level : loggingLevels) {
terminalLogger.log(level, "this level should log " + level.name());
assertEquals("this level should log " + level.name() + System.lineSeparator(), terminal.getOutput());
assertEquals("this level should log " + level.name() + "\n", terminal.getOutput());
terminal.reset();
assertThat(terminal.getOutput(), isEmptyString());
}