@Test public void testGetActionById() { //Given Action mockAction = new Action(); mockAction.setId("idAction"); mockAction.setType("createCard"); when(httpClient.get(anyString(), any(Class.class), (String[]) anyVararg())).thenReturn(mockAction); //When Action action = trello.getAction("idAction"); //Then assertThat(action).isNotNull(); assertThat(action.getId()).isEqualTo("idAction"); assertThat(action.getType()).isEqualTo("createCard"); verify(httpClient).get(eq("https://api.trello.com/1/actions/{actionId}?key={applicationKey}&token={userToken}"), eq(Action.class), eq("idAction"), eq(""), eq("")); verifyNoMoreInteractions(httpClient); }
@Test public void testGetCardActions() { //Given Action action1 = new Action(); action1.setId("idAction1"); Action action2 = new Action(); action1.setId("idAction2"); Action action3 = new Action(); action1.setId("idAction3"); when(httpClient.get(anyString(), any(Class.class), (String[]) anyVararg())).thenReturn(new Action[]{action1, action2, action3}); //When List<Action> cardActions = trello.getCardActions("idCard"); //Then assertThat(cardActions).isNotNull(); assertThat(cardActions).hasSize(3); assertThat(cardActions.get(0).getId()).isEqualTo("idAction3"); verify(httpClient).get(eq("https://api.trello.com/1/cards/{cardId}/actions?key={applicationKey}&token={userToken}"), eq(Action[].class), eq("idCard"), eq(""), eq("")); verifyNoMoreInteractions(httpClient); }
@Test public void testGetBoardActions() { // Given Action action1 = new Action(); action1.setId("idAction1"); Action action2 = new Action(); action1.setId("idAction2"); Action action3 = new Action(); action1.setId("idAction3"); when(httpClient.get(anyString(), any(Class.class), (String[]) anyVararg())).thenReturn(new Action[] { action1, action2, action3 }); // When List<Action> boardActions = trello.getBoardActions("idBoard"); // Then assertThat(boardActions).isNotNull(); assertThat(boardActions).hasSize(3); assertThat(boardActions.get(0).getId()).isEqualTo("idAction3"); verify(httpClient).get(eq("https://api.trello.com/1/boards/{boardId}/actions?key={applicationKey}&token={userToken}"), eq(Action[].class), eq("idBoard"), eq(""), eq("")); verifyNoMoreInteractions(httpClient); }
@Test public void testGetBoardActions() { List<Action> boardActions = trello.getBoardActions(BOARD_ID); assertThat(boardActions).isNotNull(); assertThat(boardActions).hasSize(26); assertThat(boardActions.get(0).getId()).isEqualTo("51990c2143453ab27e0087d5"); }
@Test public void testGetCardActions() { List<Action> cardActions = trello.getCardActions(CARD_ID); assertThat(cardActions).isNotNull(); assertThat(cardActions).hasSize(1); assertThat(cardActions.get(0).getId()).isEqualTo("5199029a7c4f3ca30a00136a"); }
@Test public void testGetActionById() { Action board = trello.getAction(ACTION_ID); assertThat(board).isNotNull(); assertThat(board.getId()).isEqualTo(ACTION_ID); assertThat(board.getType()).isEqualTo("createCard"); }