HipChat hipchat = new HipChat(HIPCHAT_KEY);
List<Room> roomsBefore = hipchat.listRooms();
int countBeforeOp = roomsBefore.size();
Room room = null;
try
{
room = hipchat.createRoom(TEST_ROOM_NAME, TEST_ROOM_OWNER, false, "test out api", false);
} catch (IOException e)
{
e.printStackTrace();
fail("Exception!");
}
assertNotNull(room);
assertEquals(TEST_ROOM_NAME, room.getName());
List<Room> roomsAfterAdd = hipchat.listRooms();
int countAfterOp = roomsAfterAdd.size();
assertEquals(countBeforeOp + 1, countAfterOp);
boolean deleted = hipchat.deleteRoom(room.getId());
assertTrue(deleted);
List<Room> roomsAfterDelete = hipchat.listRooms();
int countAfterOp2 = roomsAfterDelete.size();
assertEquals(countBeforeOp, countAfterOp2);