From b42b2a80c00e8098202720fca28e279b0b3f9fd5 Mon Sep 17 00:00:00 2001 From: Dylan Chew Date: Wed, 7 Sep 2016 11:06:08 +0800 Subject: [PATCH] add Utils test case --- src/seedu/addressbook/common/UtilsTest.java | 41 +++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 src/seedu/addressbook/common/UtilsTest.java diff --git a/src/seedu/addressbook/common/UtilsTest.java b/src/seedu/addressbook/common/UtilsTest.java new file mode 100644 index 000000000..8ed12d2f4 --- /dev/null +++ b/src/seedu/addressbook/common/UtilsTest.java @@ -0,0 +1,41 @@ +package seedu.addressbook.common; + +import static org.junit.Assert.*; +import static seedu.addressbook.common.Messages.MESSAGE_INVALID_COMMAND_FORMAT; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; + +import org.junit.Before; +import org.junit.Test; + +import seedu.addressbook.commands.HelpCommand; +import seedu.addressbook.parser.Parser; + +public class UtilsTest { + + @Test + public void emptyInput_returnsCorrect() { + final Object obj = null; + assertTrue(Utils.isAnyNull(obj)); + } + + @Test + public void NonEmptyInput_returnsIncorrect() { + final Object obj = new Object(); + assertFalse(Utils.isAnyNull(obj)); + } + + @Test + public void NonIdenticalInput_returnsCorrect() { + final ArrayList lst = new ArrayList(Arrays.asList(1,2,3,4,5)); + assertTrue(Utils.elementsAreUnique(lst)); + } + + @Test + public void IdenticalInput_returnsIncorrect() { + final ArrayList lst = new ArrayList(Arrays.asList(1,1,3,4,5)); + assertTrue(Utils.elementsAreUnique(lst)); + } +}