From fdeb28c86fc6379f665b20acd9be0c094c21a21d Mon Sep 17 00:00:00 2001 From: Gustavo Martin Morcuende Date: Fri, 23 Dec 2016 21:46:15 +0100 Subject: [PATCH] A few improvements in my unit tests --- .../java/de/spring/example/persitence/domain/AdTest.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/SpringJava/Gradle/spring-jpa-persistence/src/test/java/de/spring/example/persitence/domain/AdTest.java b/SpringJava/Gradle/spring-jpa-persistence/src/test/java/de/spring/example/persitence/domain/AdTest.java index eae39d3..466a631 100644 --- a/SpringJava/Gradle/spring-jpa-persistence/src/test/java/de/spring/example/persitence/domain/AdTest.java +++ b/SpringJava/Gradle/spring-jpa-persistence/src/test/java/de/spring/example/persitence/domain/AdTest.java @@ -1,6 +1,7 @@ package de.spring.example.persitence.domain; -import static org.junit.Assert.assertEquals; +import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertThat; import java.time.OffsetDateTime; import java.util.HashSet; @@ -34,12 +35,13 @@ public class AdTest { 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); + assertThat(ad.getAdDescriptions(), is(AD_DESCRIPTIONS)); + assertThat(ad.getAdMobileImage(), is(AD_MOBILE_IMAGE)); + assertThat(ad.getCompanyCategId(), is(COMPANY_CATEG_ID)); + assertThat(ad.getCompanyId(), is(COMPANY_ID)); + assertThat(ad.getCreatedAt(), is(CREATED_AT)); + assertThat(ad.getUpdatedAt(), is(UPDATED_AT)); + assertThat(ad.getId(), is(AD_ID)); } private static final Ad createAd() { -- 2.1.4