Пример #1
0
 @Test
 public void testCreateSychronusSession() {
   SynchronousSession session = new SynchronousSession();
   session.setOrganizer(user);
   session.setCategory(category);
   Session savedSession = sessionService.addSession(session);
   assertEquals(session.getSessionId(), savedSession.getSessionId());
 }
Пример #2
0
 @Test
 public void testCreateAsynchronousSessionSession() {
   AsynchronousSession session = new AsynchronousSession();
   session.setOrganizer(user);
   session.setCategory(category);
   session.setSecondsBetweenMoves(15);
   Session savedSession = sessionService.addSession(session);
   assertEquals(session.getSessionId(), savedSession.getSessionId());
 }
Пример #3
0
  @Test(expected = SessionServiceException.class)
  public void addSessionWithLessCardsThanRequiredPerUser() {
    Session session = new SynchronousSession();
    session.setOrganizer(user);
    session.setCategory(category);
    session.setMinNumberOfCardsPerParticipant(6);

    session = sessionService.addSession(session);
  }
Пример #4
0
  @Test
  public void testAddSyncSessionWithDateAfterToday() {
    SynchronousSession session = new SynchronousSession();
    session.setOrganizer(user);
    session.setCategory(category);
    session.setStartDateTime(LocalDateTime.now().plusDays(1));

    Session savedSession = sessionService.addSession(session);
    assertEquals(session.getSessionId(), savedSession.getSessionId());
  }
Пример #5
0
  @Test(expected = SessionServiceException.class)
  public void addSessionWithLessMaxCardsThanMinCardsThrowsException() {
    Session session = new SynchronousSession();
    session.setOrganizer(user);
    session.setCategory(category);
    session.setMinNumberOfCardsPerParticipant(5);
    session.setMaxNumberOfCardsPerParticipant(4);

    sessionService.addSession(session);
  }
Пример #6
0
  @Test
  public void addSessionWithLessCirclesThanMinimum() {
    Session session = new SynchronousSession();
    session.setOrganizer(user);
    session.setCategory(category);
    session.setAmountOfCircles(2);

    session = sessionService.addSession(session);

    Assert.assertEquals(Session.MIN_CIRCLE_AMOUNT, session.getAmountOfCircles());
  }
Пример #7
0
  @Test(expected = SessionServiceException.class)
  public void addSessionAsNonOrganizerThrowsException() {
    User nonOrganizer = new User("test-non-organizer", "pass");
    nonOrganizer.setEmail("nonorganizer@localhost");
    nonOrganizer = userRepository.save(nonOrganizer);

    Session session = new SynchronousSession();
    session.setCategory(category);
    session.setOrganizer(nonOrganizer);

    sessionService.addSession(session);
  }
Пример #8
0
  @Test
  public void testAddSessionToTopic() {
    cardService.addCardDetailsToTopic(topic, cardDetails1);
    cardService.addCardDetailsToTopic(topic, cardDetails2);
    cardService.addCardDetailsToTopic(topic, cardDetails3);
    cardService.addCardDetailsToTopic(topic, cardDetails4);
    cardService.addCardDetailsToTopic(topic, cardDetails5);

    Session session = new SynchronousSession();
    session.setOrganizer(user);
    session.setCategory(category);
    session.setTopic(this.topic);

    Session savedSession = sessionService.addSession(session);
    assertEquals(savedSession.getTopic().getName(), topic.getName());
    assertEquals(savedSession.getOrganizer().getUserId(), this.user.getUserId());
  }