File tree Expand file tree Collapse file tree
atplug-plugin-gradle/src/test/java/com/diffplug/atplug/tooling/gradle
atplug-runtime/src/main/java/com/diffplug/atplug Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -63,7 +63,7 @@ class PlugPluginTest : GradleIntegrationHarness() {
6363 " }\n " +
6464 " }" )
6565 assertFile(" src/main/resources/META-INF/MANIFEST.MF" )
66- .hasContent (
66+ .hasContentIgnoreWhitespace (
6767 " Manifest-Version: 1.0\n " +
6868 " Service-Component: OSGI-INF/com.diffplug.atplug.Apple.xml,OSGI-INF/com.d\n " +
6969 " iffplug.atplug.Orange.xml,OSGI-INF/com.diffplug.atplug.Shape\$ Circle.xml\n " +
Original file line number Diff line number Diff line change @@ -91,6 +91,12 @@ private ReadAsserter(File file) throws IOException {
9191 public void hasContent (String expected ) {
9292 Assertions .assertEquals (expected , content );
9393 }
94+
95+ public void hasContentIgnoreWhitespace (String expected ) {
96+ String actualClean = content .replace ("\n " , "" ).replace (" " , "" );
97+ String expectedClean = expected .replace ("\n " , "" ).replace (" " , "" );
98+ Assertions .assertEquals (expectedClean , actualClean );
99+ }
94100 }
95101
96102 protected WriteAsserter setFile (String path ) throws IOException {
Original file line number Diff line number Diff line change @@ -37,8 +37,10 @@ interface PlugRegistry {
3737 URL (manifestUrl.substring(0 , manifestUrl.length - PATH_MANIFEST .length) + servicePath)
3838
3939 val out = ByteArrayOutputStream ()
40- serviceUrl.openStream().transferTo(out )
41- val serviceFileContent = out .toString(StandardCharsets .UTF_8 )
40+ serviceUrl.openStream().use {
41+ it.copyTo(out )
42+ }
43+ val serviceFileContent = String (out .toByteArray(), StandardCharsets .UTF_8 )
4244 return PlugDescriptor .fromJson(serviceFileContent)
4345 }
4446
You can’t perform that action at this time.
0 commit comments