Skip to content

Commit

Permalink
Enable checks in main and test, and fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sebr72 committed Aug 16, 2023
1 parent ab15390 commit 25207f6
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 8 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ checks: build-builder
docker run --rm --user=$(shell id -u):$(shell id -g) \
--volume=$(PWD)/core/src/:/src/core/src/:ro \
--volume=$(PWD)/reports/:/src/core/build/reports/ \
--volume=$(PWD)/core/build/resources/:/src/core/build/resources/ \
mapfish_print_builder \
gradle --parallel :core:spotbugsMain :core:checkstyleMain
gradle --parallel spotbugsMain checkstyleMain spotbugsTest checkstyleTest

.PHONY: tests
tests: build-builder
Expand Down
2 changes: 2 additions & 0 deletions core/src/test/java/org/mapfish/print/config/package-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/** The parent package for processors. */
package org.mapfish.print.config;
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public MockClientHttpRequest handleRequest(URI uri, HttpMethod httpMethod) {
+ "AUTHORITY[\"EPSG\",\"4326\"]]";
MockClientHttpRequest mockClientHttpRequest = new MockClientHttpRequest();
mockClientHttpRequest.setResponse(
new MockClientHttpResponse(wkt.getBytes(), HttpStatus.OK));
new MockClientHttpResponse(wkt.getBytes(Constants.DEFAULT_CHARSET), HttpStatus.OK));
return mockClientHttpRequest;
}
});
Expand Down Expand Up @@ -143,7 +143,7 @@ public MockClientHttpRequest handleRequest(URI uri, HttpMethod httpMethod) {
+ "0],UNIT[\"Degree\",0.017453292519943295]]";
MockClientHttpRequest mockClientHttpRequest = new MockClientHttpRequest();
mockClientHttpRequest.setResponse(
new MockClientHttpResponse(wkt.getBytes(), HttpStatus.OK));
new MockClientHttpResponse(wkt.getBytes(Constants.DEFAULT_CHARSET), HttpStatus.OK));
return mockClientHttpRequest;
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import java.util.HashMap;
import java.util.Map;
import org.junit.Test;
import org.mapfish.print.Constants;
import org.mapfish.print.config.Configuration;
import org.mapfish.print.config.ConfigurationFactory;
import org.mapfish.print.wrapper.json.PJsonObject;
Expand Down Expand Up @@ -41,11 +42,11 @@ public void testPrint() throws Exception {
.replaceFirst("test", "actual")
.replace("expectedReport.svg", "actualReport.svg"));
actual.getParentFile().mkdirs();
BufferedWriter writer = new BufferedWriter(new FileWriter(actual));
writer.write(outputStream.toString());
BufferedWriter writer = new BufferedWriter(new FileWriter(actual, Constants.DEFAULT_CHARSET));
writer.write(outputStream.toString(Constants.DEFAULT_CHARSET));
writer.close();

String expected = getFileContent(BASE_DIR + "expectedReport.svg");
assertEquals(actual.toString(), expected, outputStream.toString());
assertEquals(actual.toString(), expected, outputStream.toString(Constants.DEFAULT_CHARSET));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void testCreateTaskAllDependenciesAreMissing() {

final ProcessorDependencyGraph graph = new ProcessorDependencyGraph();
//noinspection ConstantConditions
graph.addRoot(new ProcessorGraphNode(processor, null));
graph.addRoot(new ProcessorGraphNode(processor, new MetricRegistry()));
graph.createTask(values);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ protected String getPrintSpec(String file) throws IOException {
protected void setPrintSpec(String printSpec, ClientHttpRequest request) throws IOException {
request.getHeaders().setContentType(MediaType.APPLICATION_FORM_URLENCODED);

OutputStreamWriter writer = new OutputStreamWriter(request.getBody());
OutputStreamWriter writer =
new OutputStreamWriter(request.getBody(), Constants.DEFAULT_ENCODING);
writer.write(URLEncoder.encode(printSpec, Constants.DEFAULT_ENCODING));
writer.flush();
}
Expand Down

0 comments on commit 25207f6

Please sign in to comment.