### Question:
DBStackStatusUpdater { public Optional<DBStack> updateStatus(Long dbStackId, DetailedDBStackStatus detailedStatus) { return updateStatus(dbStackId, detailedStatus, ""); }  Optional<DBStack> updateStatus(Long dbStackId, DetailedDBStackStatus detailedStatus); Optional<DBStack> updateStatus(Long dbStackId, DetailedDBStackStatus detailedStatus, String statusReason);  }### Answer:
@Test public void testUpdateStatus() { dbStack.setDBStackStatus(new DBStackStatus(dbStack, DetailedDBStackStatus.CREATING_INFRASTRUCTURE, now)); DBStack savedStack = underTest.updateStatus(1L, DetailedDBStackStatus.PROVISIONED, "because").get(); verify(dbStackService).save(dbStack); verify(redbeamsInMemoryStateStoreUpdaterService).update(1L, Status.AVAILABLE); DBStackStatus dbStackStatus = savedStack.getDbStackStatus(); assertEquals(dbStack, dbStackStatus.getDBStack()); assertEquals(DetailedDBStackStatus.PROVISIONED.getStatus(), dbStackStatus.getStatus()); assertEquals("because", dbStackStatus.getStatusReason()); assertEquals(DetailedDBStackStatus.PROVISIONED, dbStackStatus.getDetailedDBStackStatus()); assertEquals(now, dbStackStatus.getCreated().longValue()); }
@Test public void testUpdateStatusSkippedWhenDeleteCompleted() { dbStack.setDBStackStatus(new DBStackStatus(dbStack, DetailedDBStackStatus.DELETE_COMPLETED, now)); underTest.updateStatus(1L, DetailedDBStackStatus.PROVISIONED, "because").get(); verify(dbStackService, never()).save(dbStack); verify(redbeamsInMemoryStateStoreUpdaterService, never()).update(anyLong(), any()); }