Package org.as.jtrello.tests.cards

Source Code of org.as.jtrello.tests.cards.CardServiceTest

package org.as.jtrello.tests.cards;

import static org.junit.Assert.fail;

import java.util.Iterator;
import java.util.List;

import org.as.jtrello.cards.Card;
import org.as.jtrello.tests.GenericServiceTest;
import org.junit.Test;

public class CardServiceTest extends GenericServiceTest {

  //TODO Check returned object values
 
  @Test
  public void testGet() {
    try {
      Card card = client.getCards().get(props.getProperty("TRELLO_CARD1"));
      System.out.println("DEBUG card=" + card.toString());
    } catch (Exception e) {
      e.printStackTrace();
      fail();
    }
    try {
      Card card = client.getCards().get(props.getProperty("TRELLO_CARD2"));
      System.out.println("DEBUG card=" + card.toString());
    } catch (Exception e) {
      e.printStackTrace();
      fail();
    }
  }
 
  @Test
  public void testGetByBoard() {
    Card card;
    try {
      List<Card> cards = client.getCards().getByBoard(props.getProperty("TRELLO_BOARD_PRIVATE"));
      Iterator<Card> iterator = cards.iterator();
      while (iterator.hasNext()) {
        card = iterator.next();
        System.out.println("DEBUG card=" + card.toString());
      }
    } catch (Exception e) {
      e.printStackTrace();
      fail();
    }
  }
 
  @Test
  public void testGetByUser() {
    Card card;
    try {
      List<Card> cards = client.getCards().getByUser(props.getProperty("TRELLO_MEMBER"));
      Iterator<Card> iterator = cards.iterator();
      while (iterator.hasNext()) {
        card = iterator.next();
        System.out.println("DEBUG card=" + card.toString());
      }
    } catch (Exception e) {
      e.printStackTrace();
      fail();
    }
  }
 
  @Test
  public void testGetByUserMe() {
    Card card;
    try {
      List<Card> cards = client.getCards().getByUser("me");
      Iterator<Card> iterator = cards.iterator();
      while (iterator.hasNext()) {
        card = iterator.next();
        System.out.println("DEBUG card=" + card.toString());
      }
    } catch (Exception e) {
      e.printStackTrace();
      fail();
    }
  }

  @Test
  public void testCreate() {
    Card card = new Card();
    card.setName("TestCard");
    card.setDesc("This card is created for test purposes.");
    card.setIdList(props.getProperty("TRELLO_LIST_TOWRITE"));
    try {
      Card newCard = client.getCards().create(card);
      System.out.println("DEBUG card=" + card.toString());
      System.out.println("DEBUG newCard=" + newCard.toString());
    } catch (Exception e) {
      e.printStackTrace();
      fail();
    }
  }
 
}
TOP

Related Classes of org.as.jtrello.tests.cards.CardServiceTest

TOP
Copyright © 2018 www.massapi.com. 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.