From 5ac2e219c45fac85785a98a78367bb3c7009440d Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sat, 5 Dec 2020 10:26:27 +0000 Subject: [PATCH] Migrate tests from slushy (#6) * pom: add junit and assertj test dependencies * pom: clean up api dependencies * pom: version set to 1.0.1 * Add test from slushy * pom: enable running of tests * pom: add stubs for disabled tiles --- pom.xml | 39 ++++++++----- .../net/kemitix/trello/TrelloCardTest.java | 56 +++++++++++++++++++ 2 files changed, 82 insertions(+), 13 deletions(-) create mode 100644 src/test/java/net/kemitix/trello/TrelloCardTest.java diff --git a/pom.xml b/pom.xml index 31a7c95..74c1eeb 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ kemitix-trello - 1.0.0 + 1.0.1 2.18 @@ -21,6 +21,10 @@ 0.14 1.18.16 3.6.0 + 5.6.1 + 3.18.1 + 2.0.2 + @@ -35,16 +39,6 @@ trello-java-wrapper ${trello-java-wrapper.version} - - javax.inject - javax.inject - 1 - - - javax.annotation - javax.annotation-api - 1.3.2 - org.apache.camel camel-api @@ -53,8 +47,21 @@ jakarta.enterprise jakarta.enterprise.cdi-api - 2.0.2 - compile + ${jakarta.enterprise.cdi-api.version} + + + + org.junit.jupiter + junit-jupiter + ${junit.version} + test + + + + org.assertj + assertj-core + ${assertj.version} + test @@ -70,6 +77,12 @@ net.kemitix.tiles:maven-plugins:${kemitix-tiles.version} net.kemitix.tiles:compiler-jdk-lts:${kemitix-tiles.version} + net.kemitix.tiles:testing:${kemitix-tiles.version} + + + + + diff --git a/src/test/java/net/kemitix/trello/TrelloCardTest.java b/src/test/java/net/kemitix/trello/TrelloCardTest.java new file mode 100644 index 0000000..79f17e3 --- /dev/null +++ b/src/test/java/net/kemitix/trello/TrelloCardTest.java @@ -0,0 +1,56 @@ +package net.kemitix.trello; + +import com.julienvey.trello.Trello; +import com.julienvey.trello.domain.Badges; +import com.julienvey.trello.domain.Card; +import com.julienvey.trello.domain.Label; +import org.assertj.core.api.WithAssertions; +import org.junit.jupiter.api.Test; + +import java.util.Date; +import java.util.List; + +public class TrelloCardTest + implements WithAssertions { + + @Test + void convertCardToTrelloCard() { + //given + Card card = getCard(); + Trello trello = null; + //when + TrelloCard trelloCard = TrelloCard.from(card, trello); + //then + assertThat((Card) trelloCard) + .usingRecursiveComparison() + .ignoringFields("dueComplete") + .isEqualTo(card); + } + + private Card getCard() { + Card c = new Card(); + c.setId("id"); + c.setName("name"); + c.setIdList("idList"); + c.setDesc("desc"); + c.setUrl("url"); + c.setDue(new Date()); + c.setIdMembers(List.of("idMember")); + c.setLabels(List.of(new Label())); + c.setBadges(new Badges()); + c.setCheckItemStates(List.of(new Card.CardCheckItem())); + c.setClosed(true); + c.setDateLastActivity(new Date()); + c.setIdBoard("idBoard"); + c.setIdChecklists(List.of("idChecklists")); + c.setIdMembersVoted(List.of("idMembersVoted")); + c.setIdShort("idShort"); + c.setIdAttachmentCover("idAttachmentCover"); + c.setManualCoverAttachment(true); + c.setPos(42); + c.setShortLink("shortLink"); + c.setShortUrl("shortUrl"); + c.setSubscribed(true); + return c; + } +} \ No newline at end of file