Ejemplo n.º 1
0
  @Test(expectedExceptions = ConflictException.class)
  public void shouldThrowConflictExceptionWhenCreatingStackWithNameThatAlreadyExists()
      throws Exception {
    final StackImpl stack = createStack("new-stack-id", stacks[0].getName());

    stackDao.create(stack);
  }
Ejemplo n.º 2
0
  @Test(expectedExceptions = ConflictException.class)
  public void shouldThrowConflictExceptionWhenCreatingStackWithIdThatAlreadyExists()
      throws Exception {
    final StackImpl stack = createStack(stacks[0].getId(), "new-name");

    stackDao.create(stack);
  }
Ejemplo n.º 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);
  }
Ejemplo n.º 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");
  }
Ejemplo n.º 5
0
 @Test(expectedExceptions = NullPointerException.class)
 public void shouldThrowNpeWhenCreatingNullStack() throws Exception {
   stackDao.create(null);
 }