Avoid using JVM’s default charset for String to byte[] in unit tests
This commit is contained in:
@@ -98,7 +98,7 @@ public class HttpRequestSnippetTests {
|
||||
"post-request-with-charset", this.snippet.getOutputDirectory())
|
||||
.request("http://localhost/foo").method("POST")
|
||||
.header("Content-Type", "text/plain;charset=UTF-8")
|
||||
.content(japaneseContent).build());
|
||||
.content(japaneseContent.getBytes("UTF-8")).build());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -93,7 +93,7 @@ public class HttpResponseSnippetTests {
|
||||
new HttpResponseSnippet().document(new OperationBuilder("response-with-charset",
|
||||
this.snippet.getOutputDirectory()).response()
|
||||
.header("Content-Type", "text/plain;charset=UTF-8")
|
||||
.content(japaneseContent).build());
|
||||
.content(japaneseContent.getBytes("UTF-8")).build());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -140,6 +140,11 @@ public class OperationBuilder {
|
||||
return this;
|
||||
}
|
||||
|
||||
public OperationRequestBuilder content(byte[] content) {
|
||||
this.content = content;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OperationRequestBuilder param(String name, String... values) {
|
||||
for (String value : values) {
|
||||
this.parameters.add(name, value);
|
||||
|
||||
Reference in New Issue
Block a user