Commit 4deb3327 authored by Shanelle Valencia's avatar Shanelle Valencia

Add more tests

parent e4882a87
<?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
......@@ -32,4 +32,20 @@ public class CalculatorTest {
Assert.assertEquals(res, 30);
}
@Test
public void assertNotNull() {
Calculator calc = new Calculator();
Assert.assertNotNull(calc);
}
@Test public void assertNull() {
Calculator calc = new Calculator();
Assert.assertNull("Failed: Not Null", calc);
}
}
......@@ -11,6 +11,8 @@ import java.util.List;
public class StringsTest {
String string;
@Before
public void beforeTest() {
......@@ -46,13 +48,39 @@ public class StringsTest {
@Test
public void testEvenWordsInSent() {
List<String> evens = new Strings().evenWordsInSent("This is a sentence with even and odd words");
List<String> actual = Arrays.asList("This", "is", "sentence", "with", "even");
String sentence = "This is a sentence with even and odd words";
List<String> expected = new Strings().evenWordsInSent(sentence);
List<String> actual = Arrays.asList(sentence.split(" "));
// List<String> actual = Arrays.asList("This", "is", "sentence", "with", "even");
// Assert.assertEquals("Failed", expected, actual);
Assert.assertNotEquals(expected, actual);
}
@Test
public void assertNotEquals() {
String sentence = "This is a sentence with even and odd words";
List<String> expected = new Strings().evenWordsInSent(sentence);
List<String> actual = Arrays.asList(sentence.split(" "));
Assert.assertEquals(evens, actual);
Assert.assertNotEquals(expected, actual);
}
@Test
public void assertNotSame() {
String sentence = "This is a sentence with even and odd words";
List<String> expected = new Strings().evenWordsInSent(sentence);
List<String> actual = Arrays.asList(sentence.split(" "));
Assert.assertNotSame("Failed: expected and actual are the same", expected, actual);
}
@AfterClass
//must be static bc its a class method
public static void afterClass() {
......
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