<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<spring.version>4.3.0.RELEASE</spring.version>
<querydsl.version>4.1.3</querydsl.version>
+
+ <!-- Be careful these two paths must match the ones configured in SONARQUBE JaCoCo plugin -->
<jacoco.it.execution.data.file>${project.basedir}/target/jacoco-it.exec</jacoco.it.execution.data.file>
<jacoco.ut.execution.data.file>${project.basedir}/target/jacoco.exec</jacoco.ut.execution.data.file>
+
<skip.unit.tests>false</skip.unit.tests>
<skip.integration.tests>true</skip.integration.tests>
</properties>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>2.10.4</version>
+ <reportSets>
+ <reportSet>
+ <id>html</id>
+ <configuration>
+ <!-- default value is http://localhost:9000 -->
+ <doctitle>API for ${project.name} ${project.version}</doctitle>
+ <windowtitle>API for ${project.name} ${project.version}</windowtitle>
+ </configuration>
+ <reports>
+ <report>javadoc</report>
+ <report>aggregate</report>
+ </reports>
+ </reportSet>
+ </reportSets>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.19.1</version>
<reportSets>
--- /dev/null
+package de.spring.example.persitence.domain;
+
+import static org.junit.Assert.assertEquals;
+
+import java.time.OffsetDateTime;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.junit.Test;
+
+import de.spring.example.persistence.domain.Ad;
+import de.spring.example.persistence.domain.AdDescription;
+
+public class AdTest {
+ // Ad
+ public static final Long AD_ID = 66L;
+ public static final Long COMPANY_ID = 2L;
+ public static final Long COMPANY_CATEG_ID = 3L;
+ public static final String AD_MOBILE_IMAGE = "slippers.jpg";
+ public static final OffsetDateTime CREATED_AT = OffsetDateTime.now().minusDays(1);
+ public static final OffsetDateTime UPDATED_AT = OffsetDateTime.now();
+
+ // AdDescription
+ public static final Long AD_DESCRIPTION_ID = 99L;
+ public static final Long LANGUAGE_ID = 3L;
+ public static final String AD_NAME = "Slippers";
+ public static final String AD_DESCRIPTION = "Slippers";
+ public static final String AD_MOBILE_TEXT = "Buy it now!";
+ public static final String AD_LINK = "http://gumartinm.name";
+ public static final Set<AdDescription> AD_DESCRIPTIONS = createAdDescriptions();
+
+
+ @Test
+ public void whenCallingConstructorWithParametersThenCreateObject() {
+ Ad ad = createAd();
+
+ assertEquals(ad.getAdDescriptions(), AD_DESCRIPTIONS);
+ assertEquals(ad.getAdMobileImage(), AD_MOBILE_IMAGE);
+ assertEquals(ad.getCompanyCategId(), COMPANY_CATEG_ID);
+ assertEquals(ad.getCreatedAt(), CREATED_AT);
+ assertEquals(ad.getUpdatedAt(), UPDATED_AT);
+ assertEquals(ad.getId(), AD_ID);
+ }
+
+ private static final Ad createAd() {
+ return new Ad(AD_ID, AD_DESCRIPTIONS, COMPANY_ID, COMPANY_CATEG_ID, AD_MOBILE_IMAGE,
+ CREATED_AT, UPDATED_AT);
+ }
+
+ private static final AdDescription createAdDescription() {
+ return new AdDescription(AD_DESCRIPTION_ID, null, LANGUAGE_ID, AD_NAME, AD_DESCRIPTION,
+ AD_MOBILE_TEXT, AD_LINK);
+ }
+
+ private static final Set<AdDescription> createAdDescriptions() {
+ AdDescription adDescription = createAdDescription();
+ Set<AdDescription> adDescriptions = new HashSet<>();
+ adDescriptions.add(adDescription);
+
+ return adDescriptions;
+ }
+}