Package com.github.hipchat.api

Examples of com.github.hipchat.api.HipChat


    private static String TEST_ROOM_NAME = "APITestRoom";

    @Test
    public void testListRooms()
    {
        HipChat hipchat = new HipChat(HIPCHAT_KEY);
        List<Room> rooms = hipchat.listRooms();
        assertNotNull(rooms);
        assertFalse(rooms.isEmpty());
    }
View Full Code Here


    }

    @Test
    public void testCreateAndDeleteRooms()
    {
        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);
    }
View Full Code Here

    }

    @Test
    public void testGetRoom()
    {
        HipChat hipchat = new HipChat(HIPCHAT_KEY);
        Room room = hipchat.getRoom(TEST_ROOM_ID);
        assertNotNull(room);

    }
View Full Code Here

    }

    @Test
    public void testGetRoomHistory()
    {
        HipChat hipchat = new HipChat(HIPCHAT_KEY);
        Room room = hipchat.getRoom(TEST_ROOM_ID);
        assertNotNull(room);
        List<HistoryMessage> messages = room.getHistory();
        assertNotNull(messages);
        assertTrue(messages.size() > 0);
    }
View Full Code Here

    }

    @Test
    public void testMessageRoom()
    {
        HipChat hipchat = new HipChat(HIPCHAT_KEY);
        Room room = hipchat.getRoom(TEST_ROOM_ID);
        assertNotNull(room);
        UserId from = UserId.create("api", "API UnitTest");
        assertTrue(room.sendMessage("test message", from, false, Color.PURPLE));
    }
View Full Code Here

    }

    @Test
    public void testCreateAndDeleteUser()
    {
        HipChat hipchat = new HipChat(HIPCHAT_KEY);
        User user = hipchat.createUser("test@unittest.com", "Test McTester", "UnitTestUser", false, "ch4ngeM3", (TimeZone) null);
        assertNotNull(user);
        assertTrue(hipchat.deleteUser(user));
    }
View Full Code Here

    }

    @Test
    public void testListUsers()
    {
        HipChat hipchat = new HipChat(HIPCHAT_KEY);
        List<User> users = hipchat.listUsers();
        assertNotNull(users);
        assertFalse(users.isEmpty());
    }
View Full Code Here

    }

    @Test
    public void testGetUser()
    {
        HipChat hipchat = new HipChat(HIPCHAT_KEY);
        UserId id = UserId.create(TEST_ROOM_OWNER);
        User user = hipchat.getUser(id);

        assertNotNull(user);
        assertEquals(user, id);
    }
View Full Code Here

    }

    @Test
    public void testUpdateUser()
    {
        HipChat hipchat = new HipChat(HIPCHAT_KEY);
        UserId id = UserId.create(TEST_ROOM_OWNER);
        User user = hipchat.getUser(id);

        assertNotNull(user);
        assertEquals(user, id);

        String existingTitle = user.getTitle();

        user = hipchat.updateUser(user, null, null, "Temporary Tester", user.isGroupAdmin(), null, null);

        assertEquals("Temporary Tester", user.getTitle());

        user = hipchat.updateUser(user, null, null, existingTitle, user.isGroupAdmin(), null, null);
    }
View Full Code Here

TOP

Related Classes of com.github.hipchat.api.HipChat

Copyright © 2015 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.