use of it.vige.rubia.model.Forum in project rubia-forums by flashboss.
the class OperationPollTest method verifyUpdatePoll.
@Test
public void verifyUpdatePoll() {
Topic topic = new Topic(new Forum("Second Test Forum"), "Fourth Test Topic");
goTo(driver, topic);
Poll pollToUpdate = getPollOfCurrentTopic(driver);
pollToUpdate.setTitle("Second Test Question");
pollToUpdate = updatePoll(driver, pollToUpdate);
pollToUpdate.getOptions().get(0).setQuestion("Third Test Answer");
pollToUpdate.getOptions().get(1).setQuestion("Fourth Test Answer");
Poll updatedPoll = updateOptions(driver, pollToUpdate);
assertEquals("Second Test Question", updatedPoll.getTitle());
assertEquals(0, updatedPoll.getVotesSum());
List<PollOption> options = updatedPoll.getOptions();
assertEquals("Third Test Answer", options.get(0).getQuestion());
assertEquals("Fourth Test Answer", options.get(1).getQuestion());
assertEquals(0, options.get(0).getVotes());
assertEquals(0, options.get(1).getVotes());
assertEquals(2, options.size());
pollToUpdate.setTitle("Fourth Test Question");
updatePoll(driver, pollToUpdate);
pollToUpdate.getOptions().get(0).setQuestion("Seventh Test Answer");
pollToUpdate.getOptions().get(1).setQuestion("Eight Test Answer");
updatedPoll = updateOptions(driver, pollToUpdate);
assertEquals("Fourth Test Question", updatedPoll.getTitle());
assertEquals(0, updatedPoll.getVotesSum());
options = updatedPoll.getOptions();
assertEquals("Seventh Test Answer", options.get(0).getQuestion());
assertEquals("Eight Test Answer", options.get(1).getQuestion());
assertEquals(0, options.get(0).getVotes());
assertEquals(0, options.get(1).getVotes());
assertEquals(2, options.size());
}
use of it.vige.rubia.model.Forum in project rubia-forums by flashboss.
the class OperationTopicTest method verifyCreatedTopics.
@Test
public void verifyCreatedTopics() {
List<Topic> topics = getTopicsOfForums(driver, new Forum("First Test Forum"), new Forum("Second Test Forum"));
assertEquals(5, topics.size());
Date today = new Date();
Topic secondTestTopic = topics.get(0);
assertEquals("First Test Category", secondTestTopic.getForum().getCategory().getTitle());
assertEquals("First Test Forum", secondTestTopic.getForum().getName());
assertTrue(secondTestTopic.getLastPostDate().compareTo(today) < 0);
assertEquals("Second Test Topic", secondTestTopic.getSubject());
assertEquals(IMPORTANT, secondTestTopic.getType());
assertEquals(0, secondTestTopic.getViewCount());
assertEquals(0, secondTestTopic.getReplies());
assertEquals("root", secondTestTopic.getPoster().getUserId());
assertEquals(1, secondTestTopic.getPosts().size());
Topic firstTestTopic = topics.get(1);
assertEquals("First Test Category", firstTestTopic.getForum().getCategory().getTitle());
assertEquals("First Test Forum", firstTestTopic.getForum().getName());
assertTrue(firstTestTopic.getLastPostDate().compareTo(today) < 0);
assertEquals("First Test Topic", firstTestTopic.getSubject());
assertEquals(NORMAL, firstTestTopic.getType());
assertEquals(0, firstTestTopic.getViewCount());
assertEquals(0, firstTestTopic.getReplies());
assertEquals("root", firstTestTopic.getPoster().getUserId());
assertEquals(1, firstTestTopic.getPosts().size());
Topic thirdTestTopic = topics.get(2);
assertEquals("First Test Category", thirdTestTopic.getForum().getCategory().getTitle());
assertEquals("Second Test Forum", thirdTestTopic.getForum().getName());
assertTrue(thirdTestTopic.getLastPostDate().compareTo(today) < 0);
assertEquals("Third Test Topic", thirdTestTopic.getSubject());
assertEquals(ADVICE, thirdTestTopic.getType());
assertEquals(0, thirdTestTopic.getViewCount());
assertEquals(0, thirdTestTopic.getReplies());
assertEquals("root", thirdTestTopic.getPoster().getUserId());
assertEquals(1, thirdTestTopic.getPosts().size());
Topic fifthTestTopic = topics.get(3);
assertEquals("First Test Category", fifthTestTopic.getForum().getCategory().getTitle());
assertEquals("Second Test Forum", fifthTestTopic.getForum().getName());
assertTrue(fifthTestTopic.getLastPostDate().compareTo(today) < 0);
assertEquals("Fifth Test with Truncation over 25 characters Topic", fifthTestTopic.getSubject());
assertEquals(IMPORTANT, fifthTestTopic.getType());
assertEquals(0, fifthTestTopic.getViewCount());
assertEquals(0, fifthTestTopic.getReplies());
assertEquals("root", fifthTestTopic.getPoster().getUserId());
assertEquals(1, fifthTestTopic.getPosts().size());
Topic fourthTestTopic = topics.get(4);
assertEquals("First Test Category", fourthTestTopic.getForum().getCategory().getTitle());
assertEquals("Second Test Forum", fourthTestTopic.getForum().getName());
assertTrue(fourthTestTopic.getLastPostDate().compareTo(today) < 0);
assertEquals("Fourth Test Topic", fourthTestTopic.getSubject());
assertEquals(IMPORTANT, fourthTestTopic.getType());
assertEquals(0, fourthTestTopic.getViewCount());
assertEquals(0, fourthTestTopic.getReplies());
assertEquals("root", fourthTestTopic.getPoster().getUserId());
assertEquals(1, fourthTestTopic.getPosts().size());
}
use of it.vige.rubia.model.Forum in project rubia-forums by flashboss.
the class OperationTopicTest method stop.
@AfterClass
public static void stop() {
String message = removeTopic(driver, new Topic(new Forum("First Test Forum"), "First Test Topic", asList(new Post[] { new Post("First Test Body") })));
assertTrue(message.equals(OK));
message = removeTopic(driver, new Topic(new Forum("Second Test Forum"), "Third Test Topic", asList(new Post[] { new Post("Third Test Body") })));
assertTrue(message.equals(OK));
message = removeTopic(driver, new Topic(new Forum("Second Test Forum"), "Fourth Test Topic", asList(new Post[] { new Post("Fourth Test Body") })));
assertTrue(message.equals(OK));
message = removeTopic(driver, new Topic(new Forum("Second Test Forum"), "Fifth Test with Truncation over 25 characters Topic", asList(new Post[] { new Post("Fifth Test with Truncation over 25 characters Body") })));
assertTrue(message.equals(OK));
message = removeForum(driver, new Forum("First Test Forum"), "Second Test Forum");
assertTrue(message.equals(REMOVED_FORUM_0_MESSAGE));
message = removeTopic(driver, new Topic(new Forum("Second Test Forum"), "Second Test Topic", asList(new Post[] { new Post("Second Test Body") })));
assertTrue(message.equals(OK));
message = removeForum(driver, new Forum("Second Test Forum"), SELECT_FORUM_TYPE);
assertTrue(message.equals(REMOVED_FORUM_1_MESSAGE));
message = removeCategory(driver, new Category("First Test Category"), SELECT_CATEGORY_TYPE);
assertTrue(message.equals(REMOVED_CATEGORY_0_MESSAGE));
message = removeCategory(driver, new Category("Second Test Category"), SELECT_CATEGORY_TYPE);
assertTrue(message.equals(REMOVED_CATEGORY_1_MESSAGE));
}
use of it.vige.rubia.model.Forum in project rubia-forums by flashboss.
the class MyForumsForumTest method verifyRegisteredCanceledForums.
@Test
public void verifyRegisteredCanceledForums() {
Forum forum = new Forum("Fourth Test Forum", "Fourth Test Description", new Category("Second Test Category"));
String message = registerForum(driver, forum, EMAIL_NO_NOTIFICATION, CANCEL);
assertTrue(message.equals("Fourth Test Forum"));
assertTrue(!isRegistered(driver, forum));
}
use of it.vige.rubia.model.Forum in project rubia-forums by flashboss.
the class MyForumsForumTest method verifyAllForumsForum.
@Test
public void verifyAllForumsForum() {
Forum forum = new Forum("Third Test Forum", "Third Test Description", new Category("Second Test Category"));
Forum result = ViewAllForumsSelectForum.selectForum(driver, forum);
assertTrue(result != null);
assertEquals(forum.getName(), result.getName());
assertEquals(0, result.getTopics().size());
assertEquals(forum.getCategory().getTitle(), result.getCategory().getTitle());
}
Aggregations