Skip to content

Commit

Permalink
fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
angryziber committed Feb 11, 2023
1 parent 3d4dc8e commit efa5690
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions test/net/azib/ipscan/exporters/AbstractExporterTestCase.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
* @author Anton Keks
*/
public abstract class AbstractExporterTestCase {

protected Exporter exporter;
protected ByteArrayOutputStream outputStream;
protected String outputContent;
Expand All @@ -46,7 +45,7 @@ public void testFilenameExtension() {

@Test
public void testStreamFlushAndClose() throws IOException {
final boolean wasClosed[] = new boolean[] {false, false};
final boolean[] wasClosed = new boolean[] {false, false};
Exporter exporter2 = createExporter();
OutputStream mockOutputStream = new OutputStream() {
public void write(int b) throws IOException {
Expand Down Expand Up @@ -74,8 +73,8 @@ public void flush() {
public void testBasic() throws Exception {
exporter.start(outputStream, "feederstuff");
exporter.setFetchers(new String[] {"IP", "hello", "fetcher2"});
exporter.nextAddressResults(new Object[] {InetAddress.getLocalHost().getHostAddress(), "world", new Integer(53)});
exporter.nextAddressResults(new Object[] {InetAddress.getLocalHost().getHostAddress(), "buga", new Integer(-1)});
exporter.nextAddressResults(new Object[] {InetAddress.getLocalHost().getHostAddress(), "world", 53});
exporter.nextAddressResults(new Object[] {InetAddress.getLocalHost().getHostAddress(), "buga", -1});
exporter.end();
assertContains(InetAddress.getLocalHost().getHostAddress());
assertContains("hello");
Expand Down Expand Up @@ -124,13 +123,11 @@ public void testNextAddressResultsWithNulls() throws IOException {
protected void assertContains(String string, boolean contains) throws IOException {
if (outputContent == null) {
outputStream.close();
// TODO: encoding???
outputContent = new String(outputStream.toByteArray());
outputContent = outputStream.toString();
}

if (!((outputContent.indexOf(string) >= 0) ^ (!contains))) {
if (outputContent.contains(string) == !contains)
throw new ComparisonFailure("Contains check failed", string, outputContent);
}
}

protected void assertContains(String string) throws IOException {
Expand Down

0 comments on commit efa5690

Please sign in to comment.