com.github.tomakehurst.wiremock.common.BinaryFile Java Examples
The following examples show how to use
com.github.tomakehurst.wiremock.common.BinaryFile.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ResourcesFileSource.java From spring-cloud-contract with Apache License 2.0 | 5 votes |
@Override public BinaryFile getBinaryFileNamed(String name) { for (FileSource resource : this.sources) { try { UrlResource uri = new UrlResource(resource.getUri()); if (uri.exists()) { return resource.getBinaryFileNamed(name); } } catch (IOException e) { // Ignore } } throw new IllegalStateException("Cannot create file for " + name); }
Example #2
Source File: BodyTransformer.java From wiremock-body-transformer with Apache License 2.0 | 5 votes |
private String getResponseBody(ResponseDefinition responseDefinition, FileSource fileSource) { String body; if (responseDefinition.getBody() != null) { body = responseDefinition.getBody(); } else { BinaryFile binaryFile = fileSource.getBinaryFileNamed(responseDefinition.getBodyFileName()); body = new String(binaryFile.readContents(), StandardCharsets.UTF_8); } return body; }
Example #3
Source File: AndroidAssetsReadOnlyFileSource.java From AndroidHttpMockingExamples with Apache License 2.0 | 4 votes |
@Override public BinaryFile getBinaryFileNamed(String name) { return new AndroidAssetsBinaryFile(assetManager, assetPath + "/" + name); }