diff options
author | Jesse Morgan <jesse@jesterpm.net> | 2016-04-09 15:53:24 -0700 |
---|---|---|
committer | Jesse Morgan <jesse@jesterpm.net> | 2016-04-09 15:53:24 -0700 |
commit | 371ccae3d1f31ec38f4af77fb7fcd175d49b3cd5 (patch) | |
tree | 38c4f1e8828f9af9c4b77a173bee0d312b321698 /tst/com/p4square/grow/model/QuestionTest.java | |
parent | bbf907e51dfcf157bdee24dead1d531122aa25db (diff) | |
parent | 3102d8bce3426d9cf41aeaf201c360d342677770 (diff) |
Merge pull request #10 from PuyallupFoursquare/maven
Switching from Ivy+Ant to Maven.
Diffstat (limited to 'tst/com/p4square/grow/model/QuestionTest.java')
-rw-r--r-- | tst/com/p4square/grow/model/QuestionTest.java | 80 |
1 files changed, 0 insertions, 80 deletions
diff --git a/tst/com/p4square/grow/model/QuestionTest.java b/tst/com/p4square/grow/model/QuestionTest.java deleted file mode 100644 index d09d2d8..0000000 --- a/tst/com/p4square/grow/model/QuestionTest.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2013 Jesse Morgan - */ - -package com.p4square.grow.model; - -import org.junit.Test; - -import static org.junit.Assert.*; - -/** - * Tests for the Question class. - * - * @author Jesse Morgan <jesse@jesterpm.net> - */ -public class QuestionTest { - public static void main(String... args) { - org.junit.runner.JUnitCore.main(QuestionTest.class.getName()); - } - - /** - * Verify that all the getters and setters function. - */ - @Test - public void testGetAndSet() { - TextQuestion q = new TextQuestion(); - - q.setId("123"); - assertEquals("123", q.getId()); - - q.setQuestion("Hello World"); - assertEquals("Hello World", q.getQuestion()); - - q.setPreviousQuestion("122"); - assertEquals("122", q.getPreviousQuestion()); - - q.setNextQuestion("124"); - assertEquals("124", q.getNextQuestion()); - } - - /** - * Verify the correct next question is returned. - */ - @Test - public void testGetNextQuestion() { - // Setup the Question - TextQuestion q = new TextQuestion(); - q.setNextQuestion("defaultNext"); - - Answer answerWithNext = new Answer(); - answerWithNext.setNextQuestion("answerNext"); - - q.getAnswers().put("withNext", answerWithNext); - q.getAnswers().put("withoutNext", new Answer()); - - // Answer without a nextQuestion should return default. - assertEquals("defaultNext", q.getNextQuestion("withoutNext")); - - // Answer with a nextQuestion should return it's next question. - assertEquals("answerNext", q.getNextQuestion("withNext")); - - // Unknown answer should also return the default - assertEquals("defaultNext", q.getNextQuestion("unknownAnswer")); - } - - /** - * Validate the toString() results for the enum. - * - * This may seem like an odd test, but it is very important for these to be - * lowercase to match the values in the JSON files. - */ - @Test - public void testToString() { - assertEquals("text", Question.QuestionType.TEXT.toString()); - assertEquals("image", Question.QuestionType.IMAGE.toString()); - assertEquals("slider", Question.QuestionType.SLIDER.toString()); - assertEquals("quad", Question.QuestionType.QUAD.toString()); - assertEquals("circle", Question.QuestionType.CIRCLE.toString()); - } -} |