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
This commit is contained in:
Paul Campbell 2020-12-05 10:26:27 +00:00 committed by GitHub
parent c7e5e47537
commit 5ac2e219c4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 82 additions and 13 deletions

39
pom.xml
View file

@ -12,7 +12,7 @@
</parent> </parent>
<artifactId>kemitix-trello</artifactId> <artifactId>kemitix-trello</artifactId>
<version>1.0.0</version> <version>1.0.1</version>
<properties> <properties>
<tiles-maven-plugin.version>2.18</tiles-maven-plugin.version> <tiles-maven-plugin.version>2.18</tiles-maven-plugin.version>
@ -21,6 +21,10 @@
<trello-java-wrapper.version>0.14</trello-java-wrapper.version> <trello-java-wrapper.version>0.14</trello-java-wrapper.version>
<lombok.version>1.18.16</lombok.version> <lombok.version>1.18.16</lombok.version>
<camel-api.version>3.6.0</camel-api.version> <camel-api.version>3.6.0</camel-api.version>
<junit.version>5.6.1</junit.version>
<assertj.version>3.18.1</assertj.version>
<jakarta.enterprise.cdi-api.version>2.0.2
</jakarta.enterprise.cdi-api.version>
</properties> </properties>
<dependencies> <dependencies>
@ -35,16 +39,6 @@
<artifactId>trello-java-wrapper</artifactId> <artifactId>trello-java-wrapper</artifactId>
<version>${trello-java-wrapper.version}</version> <version>${trello-java-wrapper.version}</version>
</dependency> </dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.2</version>
</dependency>
<dependency> <dependency>
<groupId>org.apache.camel</groupId> <groupId>org.apache.camel</groupId>
<artifactId>camel-api</artifactId> <artifactId>camel-api</artifactId>
@ -53,8 +47,21 @@
<dependency> <dependency>
<groupId>jakarta.enterprise</groupId> <groupId>jakarta.enterprise</groupId>
<artifactId>jakarta.enterprise.cdi-api</artifactId> <artifactId>jakarta.enterprise.cdi-api</artifactId>
<version>2.0.2</version> <version>${jakarta.enterprise.cdi-api.version}</version>
<scope>compile</scope> </dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertj.version}</version>
<scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>
@ -70,6 +77,12 @@
<tiles> <tiles>
<tile>net.kemitix.tiles:maven-plugins:${kemitix-tiles.version}</tile> <tile>net.kemitix.tiles:maven-plugins:${kemitix-tiles.version}</tile>
<tile>net.kemitix.tiles:compiler-jdk-lts:${kemitix-tiles.version}</tile> <tile>net.kemitix.tiles:compiler-jdk-lts:${kemitix-tiles.version}</tile>
<tile>net.kemitix.tiles:testing:${kemitix-tiles.version}</tile>
<!--<tile>net.kemitix.tiles:pmd:${kemitix-tiles.version}</tile>-->
<!--<tile>net.kemitix.tiles:spotbugs:${kemitix-tiles.version}</tile>-->
<!--<tile>net.kemitix.tiles:coverage:${kemitix-tiles.version}</tile>-->
<!--<tile>net.kemitix.tiles:pitest:${kemitix-tiles.version}</tile>-->
<!--<tile>net.kemitix.tiles:pmd-strict:${kemitix-tiles.version}</tile>-->
</tiles> </tiles>
</configuration> </configuration>
</plugin> </plugin>

View file

@ -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;
}
}