Commit 285c671e authored by ccottier's avatar ccottier

added negative test case

parent 8ee40b71
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
......@@ -13,6 +13,7 @@ public class ZigZagConversionAlgo {
}
public static String convertString(String str, int rows){
if (rows < 1) return "Row integer out of bounds.";
resultString = "";
listOfSubstrings = populateArrayList(rows);
distributeLetters(str,rows);
......
......@@ -16,14 +16,15 @@ public class ZigZagConversionAlgoTest {
Assert.assertEquals("result 3 incorrect", res3, "A");
}
// @Test
// public void handlesOutOfBounds(){
// String res1 = ZigZagConversionAlgo.convertString("PAYPALISHIRING", -1);
//
// Assert.assertFalse(res1.getClass() == "String");
// Assert.assertTrue;
//
// }
@Test
public void handlesOutOfBounds(){
String res1 = ZigZagConversionAlgo.convertString("PAYPALISHIRING", -1);
Assert.assertFalse(res1 == "PAYPALISHIRING");
Assert.assertTrue(res1 == "Row integer out of bounds.");
}
}
/*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment