@Test(expectedExceptions = ConflictException.class) public void shouldThrowConflictExceptionWhenCreatingStackWithNameThatAlreadyExists() throws Exception { final StackImpl stack = createStack("new-stack-id", stacks[0].getName()); stackDao.create(stack); }
@Test(expectedExceptions = ConflictException.class) public void shouldThrowConflictExceptionWhenCreatingStackWithIdThatAlreadyExists() throws Exception { final StackImpl stack = createStack(stacks[0].getId(), "new-name"); stackDao.create(stack); }
@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); }
@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"); }
@Test(expectedExceptions = NullPointerException.class) public void shouldThrowNpeWhenCreatingNullStack() throws Exception { stackDao.create(null); }