Test: use System.lineSeperator instead of `\n`
This changes the native realm migrate tool tests to use the System.lineSeperator instead of `\n`
so that the tests will pass on Windows.
Original commit: elastic/x-pack-elasticsearch@d3f9a71ac4b6ee883fc6a92c98a3c6202c4125e0
@@ -16,7 +16,6 @@ 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;
@@ -76,12 +75,12 @@ public class ESNativeRealmMigrateToolTests extends CommandTestCase {
}
terminalLogger.log(Level.ERROR, "logging an error");
- assertEquals("logging an error\n", terminal.getOutput());
+ assertEquals("logging an error" + System.lineSeparator(), terminal.getOutput());
terminal.reset();
assertThat(terminal.getOutput(), isEmptyString());
terminalLogger.log(Level.FATAL, "logging a fatal message");
- assertEquals("logging a fatal message\n", terminal.getOutput());
+ assertEquals("logging a fatal message" + System.lineSeparator(), terminal.getOutput());
terminal.reset();
assertThat(terminal.getOutput(), isEmptyString());
@@ -91,7 +90,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() + "\n", terminal.getOutput());
+ assertEquals("this level should log " + level.name() + System.lineSeparator(), terminal.getOutput());
terminal.reset();
assertThat(terminal.getOutput(), isEmptyString());
}
