Skip to content

Commit

Permalink
Remove a few spots that can be NULL in the unit tets
Browse files Browse the repository at this point in the history
Signed-off-by: Keith Mannthey <[email protected]>
  • Loading branch information
Kmannth committed Jan 31, 2022
1 parent d641020 commit 45ff1bb
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 18 deletions.
2 changes: 0 additions & 2 deletions src/test/java/com/intel/gkl/IntelGKLUtilsUnitTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ public void childThreadTest() {
@Test(enabled = true)
public void testInvalidInputsForPathToTestResource() {

IntelGKLUtils utils = new IntelGKLUtils();

try {
IntelGKLUtils.pathToTestResource(null);
Assert.fail("NullPointerException expected.");
Expand Down
2 changes: 2 additions & 0 deletions src/test/java/com/intel/gkl/compression/DeflaterUnitTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ public void deflateEmptyInputBufferTest() {
byte[] outputBufferBad = new byte[LEN];
deflater.setInput(inputBuffer, 0, inputBuffer.length);
int bytes = deflater.deflate(outputBufferBad, 0, outputBufferBad.length);
if (bytes != 0)
Assert.fail();
} catch (Exception e) {
log.error(e.getMessage());
throw e;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,9 @@ public void inflateEmptyInputBufferSetOverflowTest() throws DataFormatException,

inflater.setInput(input, 0, input.length);
int resultLength = inflater.inflate(result, 0 , 1024);
inflater.end();
if (resultLength != 0)
Assert.fail();
inflater.end();
}
catch(RuntimeException dfe) {
log.error(dfe.getMessage());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ public void inputDataTest() {
altString = in.readLine();
} catch (IOException e) {System.err.println("Caught IOException: " + e.getMessage());}
try {
smithWaterman.align(null, altString.getBytes("UTF-8"), SWparameters, SWstrategy);
if (altString != null)
smithWaterman.align(null, altString.getBytes("UTF-8"), SWparameters, SWstrategy);
Assert.fail("NullPointerException expected.");
} catch(NullPointerException e) {}

Expand Down Expand Up @@ -231,27 +232,27 @@ public void simpleTest() {
refString = in.readLine();
} catch (IOException e) {System.err.println("Caught IOException: " + e.getMessage());}

while(refString !=null) {
while(refString !=null) {

ref = refString.getBytes("UTF-8");
try {
altString = in.readLine();
} catch (IOException e) {System.err.println("Caught IOException: " + e.getMessage());}
alt = altString.getBytes("UTF-8");

//Get the results for one pair
SWNativeAlignerResult result = smithWaterman.align(refString.getBytes("UTF-8"), altString.getBytes("UTF-8"), SWparameters, SWstrategy);

try {
refString = in.readLine();
} catch (IOException e) {System.err.println("Caught IOException: " + e.getMessage());}
ref = refString.getBytes("UTF-8");
try {
altString = in.readLine();
} catch (IOException e) {System.err.println("Caught IOException: " + e.getMessage());}

if (altString !=null) {
alt = altString.getBytes("UTF-8");
//Get the results for one pair
SWNativeAlignerResult result = smithWaterman.align(refString.getBytes("UTF-8"), altString.getBytes("UTF-8"), SWparameters, SWstrategy);
}
try {
refString = in.readLine();
} catch (IOException e) {System.err.println("Caught IOException: " + e.getMessage());}

}
in.close();
input.close();
} catch (java.io.IOException e) {
e.printStackTrace();
e.printStackTrace();
}
smithWaterman.close();
}
Expand Down

0 comments on commit 45ff1bb

Please sign in to comment.