Esempio n. 1
0
  @Before
  public void setup() {
    user = new User("test-user", "pass");
    user.setEmail("test@localhost");
    user = userRepository.save(user);

    organization = new Organization("test-organization", user);
    organization = organizationRepository.save(organization);

    category = new Category();
    category.setOrganization(organization);
    category.setName("Category 1");
    category.setDescription("Category description");
    category = categoryRepository.save(category);

    topic = new Topic();
    topic.setCategory(category);
    topic.setName("Topic 1");
    topic.setDescription("Topic description");
    topic = topicRepository.save(topic);

    cardDetails1 = new CardDetails();
    cardDetails1.setCategory(category);
    cardDetails1.setCreator(user);
    cardDetails1.setText("Card 1");
    cardDetails1 = cardDetailsRepository.save(cardDetails1);

    cardDetails2 = new CardDetails();
    cardDetails2.setCategory(category);
    cardDetails2.setCreator(user);
    cardDetails2.setText("Card 2");
    cardDetails2 = cardDetailsRepository.save(cardDetails2);

    cardDetails3 = new CardDetails();
    cardDetails3.setCategory(category);
    cardDetails3.setCreator(user);
    cardDetails3.setText("Card 3");
    cardDetails3 = cardDetailsRepository.save(cardDetails3);

    cardDetails4 = new CardDetails();
    cardDetails4.setCategory(category);
    cardDetails4.setCreator(user);
    cardDetails4.setText("Card 4");
    cardDetails4 = cardDetailsRepository.save(cardDetails4);

    cardDetails5 = new CardDetails();
    cardDetails5.setCategory(category);
    cardDetails5.setCreator(user);
    cardDetails5.setText("Card 5");
    cardDetails5 = cardDetailsRepository.save(cardDetails5);

    category.setCards(new HashSet<>());
    category.getCards().add(cardDetails1);
    category.getCards().add(cardDetails2);
    category.getCards().add(cardDetails3);
    category.getCards().add(cardDetails4);
    category.getCards().add(cardDetails5);

    category = categoryRepository.save(category);
  }
Esempio n. 2
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);
  }