Skip to content

Commit

Permalink
Fix windows newline issue in test
Browse files Browse the repository at this point in the history
Fixes HttpCertificateCommandTests.testTextFileSubstitutions on Windows

Resolves: elastic#50964
Backport of: elastic#51030
  • Loading branch information
tvernum committed Jan 16, 2020
1 parent c1a6d5d commit a1a32bb
Showing 1 changed file with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import com.google.common.jimfs.Configuration;
import com.google.common.jimfs.Jimfs;
import joptsimple.OptionSet;
import org.apache.lucene.util.Constants;
import org.bouncycastle.asn1.DERIA5String;
import org.bouncycastle.asn1.DEROctetString;
import org.bouncycastle.asn1.DERSequence;
Expand Down Expand Up @@ -537,13 +536,12 @@ public void testGuessFileType() throws Exception {
}

public void testTextFileSubstitutions() throws Exception {
assumeFalse("https://github.com/elastic/elasticsearch/issues/50964", Constants.WINDOWS);
CheckedBiFunction<String, Map<String, String>, String, Exception> copy = (source, subs) -> {
try (InputStream in = new ByteArrayInputStream(source.getBytes(StandardCharsets.UTF_8));
StringWriter out = new StringWriter();
PrintWriter writer = new PrintWriter(out)) {
HttpCertificateCommand.copyWithSubstitutions(in, writer, subs);
return out.toString();
return out.toString().replace("\r\n", "\n");
}
};
assertThat(copy.apply("abc\n", Collections.emptyMap()), is("abc\n"));
Expand Down

0 comments on commit a1a32bb

Please sign in to comment.