Skip to content

Commit

Permalink
Pass expected result as expected, not actual
Browse files Browse the repository at this point in the history
  • Loading branch information
tivervac committed Apr 26, 2024
1 parent c8d834f commit 3980d24
Showing 1 changed file with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
*******************************************************************************/
package org.eclipse.pde.genericeditor.extension.tests;

import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertEquals;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.Scanner;

Expand Down Expand Up @@ -50,8 +50,7 @@ public void testSettingNullPersists() throws Exception {
ByteArrayOutputStream actualOutput = new ByteArrayOutputStream();
targetDefinition.setProgramArguments(null);
TargetDefinitionPersistenceHelper.persistXML(targetDefinition, actualOutput);
assertEquals(expectedOutput.toString(StandardCharsets.UTF_8.toString()),
actualOutput.toString(StandardCharsets.UTF_8.toString()));
assertEquals(expectedOutput.toString(UTF_8.toString()), actualOutput.toString(UTF_8.toString()));
}

@Test
Expand Down Expand Up @@ -105,9 +104,6 @@ public void testITargetLocationExtensionSerialization() throws Exception {
confirmMatch(targetDefinition, "ITargetLocationExtensionTestCaseTarget.txt");
}

public static void assertEqualStringIgnoreDelim(String actual, String expected) throws IOException {
StringAsserts.assertEqualStringIgnoreDelim(actual, expected);
}
private void confirmMatch(ITargetDefinition targetDefinition, String expectedDefinitionPath) throws Exception {
try (Scanner s = new Scanner(FrameworkUtil.getBundle(this.getClass())
.getEntry("testing-files/target-files/" + expectedDefinitionPath).openStream()).useDelimiter("\\A")) {
Expand All @@ -123,7 +119,7 @@ private void confirmMatch(ITargetDefinition targetDefinition, String expectedDef
ByteArrayOutputStream actualOutput = new ByteArrayOutputStream();
TargetDefinitionPersistenceHelper.persistXML(targetDefinition, actualOutput);

assertEqualStringIgnoreDelim(result, actualOutput.toString(StandardCharsets.UTF_8.toString()));
StringAsserts.assertEqualStringIgnoreDelim(actualOutput.toString(UTF_8.toString()), result);
} catch (IOException e) {
}
}
Expand Down

0 comments on commit 3980d24

Please sign in to comment.