Skip to content

Commit

Permalink
Refactor bad smell UnnecessaryToStringCall
Browse files Browse the repository at this point in the history
The toString() method is not needed in cases the underlying method handles the conversion. Also calling toString() on a String is redundant. Removing them simplifies the code.
  • Loading branch information
MartinWitt committed Jun 24, 2023
1 parent 5abc5e8 commit 8ec366a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Expand Up @@ -212,10 +212,10 @@ public void testBaseMetadataSingluarItemsPromMetrics() {

if (tmp[2].startsWith(promName)) {
found = true;
assertEquals("Expected [" + mm.toString() + "] got [" + line + "]", tmp[3], mm.type);
assertEquals("Expected [" + mm + "] got [" + line + "]", tmp[3], mm.type);
}
}
assertTrue("Not found [" + mm.toString() + "]", found);
assertTrue("Not found [" + mm + "]", found);

}
}
Expand Down Expand Up @@ -425,3 +425,5 @@ public String toString() {
}

}


Expand Up @@ -194,7 +194,7 @@ public void getAsync(@Suspended final AsyncResponse asyncResponse) throws Except
Thread.sleep(5000);
asyncResponse.resume("This is a GET request with AsyncResponse");
} catch (Exception e) {
System.err.println(e.toString());
System.err.println(e);
}
});
thread.start();
Expand Down Expand Up @@ -250,3 +250,4 @@ public String postUnmappedArithException() throws Exception {
}

}

0 comments on commit 8ec366a

Please sign in to comment.