Пример #1
0
  @Test(expectedExceptions = ConflictException.class)
  public void shouldThrowConflictExceptionWhenCreatingStackWithNameThatAlreadyExists()
      throws Exception {
    final StackImpl stack = createStack("new-stack-id", stacks[0].getName());

    stackDao.create(stack);
  }
Пример #2
0
  @Test(expectedExceptions = ConflictException.class)
  public void shouldThrowConflictExceptionWhenCreatingStackWithIdThatAlreadyExists()
      throws Exception {
    final StackImpl stack = createStack(stacks[0].getId(), "new-name");

    stackDao.create(stack);
  }
Пример #3
0
  @Test(dependsOnMethods = "shouldGetById")
  public void shouldCreateStack() throws Exception {
    final StackImpl stack = createStack("new-stack", "new-stack-name");

    stackDao.create(stack);

    assertEquals(stackDao.getById(stack.getId()), stack);
  }
Пример #4
0
  @Test
  public void shouldPublishStackPersistedEventAfterStackIsPersisted() throws Exception {
    final boolean[] isNotified = new boolean[] {false};
    eventService.subscribe(event -> isNotified[0] = true, StackPersistedEvent.class);

    stackDao.create(createStack("test", "test"));

    assertTrue(isNotified[0], "Event subscriber notified");
  }
Пример #5
0
 @Test(expectedExceptions = NullPointerException.class)
 public void shouldThrowNpeWhenCreatingNullStack() throws Exception {
   stackDao.create(null);
 }