From e7cc45644ebf45fb9725b78318a9e1faa7f934a0 Mon Sep 17 00:00:00 2001 From: Grzegorz Piwowarek Date: Mon, 3 Apr 2017 18:03:10 +0200 Subject: [PATCH] Optimize build (#1582) --- ...t.java => JsoupParserIntegrationTest.java} | 4 +- pom.xml | 1 + spring-data-gemfire/pom.xml | 6 +++ ...=> EmployeeRepositoryIntegrationTest.java} | 6 +-- spring-data-javaslang/pom.xml | 17 +++++-- ...gTests.java => SpringIntegrationTest.java} | 45 ++++++++++--------- 6 files changed, 50 insertions(+), 29 deletions(-) rename jsoup/src/test/java/com/baeldung/jsoup/{JsoupParserTest.java => JsoupParserIntegrationTest.java} (98%) rename spring-data-gemfire/src/test/java/com/baeldung/spring/data/gemfire/repository/{EmployeeRepositoryTest.java => EmployeeRepositoryIntegrationTest.java} (96%) rename spring-data-javaslang/src/test/java/com/baeldung/spring_data_tests/{SpringTests.java => SpringIntegrationTest.java} (80%) diff --git a/jsoup/src/test/java/com/baeldung/jsoup/JsoupParserTest.java b/jsoup/src/test/java/com/baeldung/jsoup/JsoupParserIntegrationTest.java similarity index 98% rename from jsoup/src/test/java/com/baeldung/jsoup/JsoupParserTest.java rename to jsoup/src/test/java/com/baeldung/jsoup/JsoupParserIntegrationTest.java index ba6d7358bc..dadd57b0ed 100644 --- a/jsoup/src/test/java/com/baeldung/jsoup/JsoupParserTest.java +++ b/jsoup/src/test/java/com/baeldung/jsoup/JsoupParserIntegrationTest.java @@ -14,9 +14,9 @@ import java.io.IOException; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -public class JsoupParserTest { +public class JsoupParserIntegrationTest { - Document doc; + private Document doc; @Before public void setUp() throws IOException { diff --git a/pom.xml b/pom.xml index c8d060ec04..a6b46a0e39 100644 --- a/pom.xml +++ b/pom.xml @@ -129,6 +129,7 @@ spring-data-couchbase-2 spring-data-dynamodb spring-data-elasticsearch + spring-data-javaslang spring-data-mongodb spring-data-neo4j spring-data-redis diff --git a/spring-data-gemfire/pom.xml b/spring-data-gemfire/pom.xml index f387b04651..eb450ebc81 100644 --- a/spring-data-gemfire/pom.xml +++ b/spring-data-gemfire/pom.xml @@ -75,6 +75,12 @@ org.apache.maven.plugins maven-surefire-plugin ${maven-surefire-plugin.version} + + + **/*IntegrationTest.java + **/*LiveTest.java + + diff --git a/spring-data-gemfire/src/test/java/com/baeldung/spring/data/gemfire/repository/EmployeeRepositoryTest.java b/spring-data-gemfire/src/test/java/com/baeldung/spring/data/gemfire/repository/EmployeeRepositoryIntegrationTest.java similarity index 96% rename from spring-data-gemfire/src/test/java/com/baeldung/spring/data/gemfire/repository/EmployeeRepositoryTest.java rename to spring-data-gemfire/src/test/java/com/baeldung/spring/data/gemfire/repository/EmployeeRepositoryIntegrationTest.java index 8714ad2d81..26f7bc8a4e 100644 --- a/spring-data-gemfire/src/test/java/com/baeldung/spring/data/gemfire/repository/EmployeeRepositoryTest.java +++ b/spring-data-gemfire/src/test/java/com/baeldung/spring/data/gemfire/repository/EmployeeRepositoryIntegrationTest.java @@ -18,13 +18,13 @@ import static junit.framework.Assert.assertEquals; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes=GemfireConfiguration.class, loader=AnnotationConfigContextLoader.class) -public class EmployeeRepositoryTest { +public class EmployeeRepositoryIntegrationTest { - @Autowired + @Autowired private EmployeeRepository employeeRepository; @Autowired - FunctionExecution execution; + private FunctionExecution execution; @Test public void whenEmployeeIsSaved_ThenAbleToRead(){ diff --git a/spring-data-javaslang/pom.xml b/spring-data-javaslang/pom.xml index c265e893cc..76fbce1e2e 100644 --- a/spring-data-javaslang/pom.xml +++ b/spring-data-javaslang/pom.xml @@ -1,8 +1,8 @@ 4.0.0 - spring-data-javaslangb - spring-data-javaslangb + spring-data-javaslang + spring-data-javaslang 0.0.1-SNAPSHOT UTF-8 @@ -65,7 +65,18 @@ ${project.build.testSourceDirectory} - + + org.apache.maven.plugins + maven-surefire-plugin + ${maven-surefire-plugin.version} + + + **/*IntegrationTest.java + **/*LiveTest.java + + + + diff --git a/spring-data-javaslang/src/test/java/com/baeldung/spring_data_tests/SpringTests.java b/spring-data-javaslang/src/test/java/com/baeldung/spring_data_tests/SpringIntegrationTest.java similarity index 80% rename from spring-data-javaslang/src/test/java/com/baeldung/spring_data_tests/SpringTests.java rename to spring-data-javaslang/src/test/java/com/baeldung/spring_data_tests/SpringIntegrationTest.java index 59a6c120fa..7a23fa1ef2 100644 --- a/spring-data-javaslang/src/test/java/com/baeldung/spring_data_tests/SpringTests.java +++ b/spring-data-javaslang/src/test/java/com/baeldung/spring_data_tests/SpringIntegrationTest.java @@ -1,34 +1,33 @@ package com.baeldung.spring_data_tests; -import org.junit.Test; -import org.junit.runner.RunWith; - -import com.baeldung.spring_data_app.MainApp; import com.baeldung.spring_data.model.Book; import com.baeldung.spring_data.model.JavaBook; import com.baeldung.spring_data.repository.BookRepository; import com.baeldung.spring_data.repository.JavaBookRepository; - +import com.baeldung.spring_data_app.MainApp; +import javaslang.collection.List; +import javaslang.collection.Seq; +import javaslang.control.Option; +import org.junit.Test; +import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.test.context.junit4.SpringRunner; -import javaslang.collection.Seq; -import javaslang.collection.List; -import javaslang.control.Option; - import java.util.ArrayList; +import static org.assertj.core.api.Assertions.assertThat; + @RunWith(SpringRunner.class) @SpringBootTest(classes = MainApp.class,webEnvironment = WebEnvironment.NONE) -public class SpringTests { +public class SpringIntegrationTest { @Autowired - JavaBookRepository javaRepository; + private JavaBookRepository javaRepository; @Autowired - BookRepository repository; + private BookRepository repository; @Test public void should_return_seq(){ @@ -38,7 +37,8 @@ public class SpringTests { testBook.setAuthors(authors); Book book = repository.save(testBook); Option> books = repository.findByTitleContaining("Seq Test"); - assert(!books.isEmpty()); + + assertThat(books).isNotEmpty(); } @@ -50,8 +50,9 @@ public class SpringTests { testBook.setAuthors(authors); Book book = repository.save(testBook); Option retBook = repository.findById(1L); - assert(retBook.isDefined() && !retBook.isEmpty()); - assert(retBook.get() != null); + + assertThat(retBook.isDefined()).isTrue(); + assertThat(retBook).isNotEmpty(); } @Test @@ -64,9 +65,11 @@ public class SpringTests { testBook.setAuthors(authors); JavaBook book = javaRepository.save(testBook); java.util.List books = javaRepository.findByTitleContaining("Seq"); - assert(!books.isEmpty()); - assert(books.size() == 1); - assert(books.get(0).getTitle().equals("Javaslang in Spring Data Seq Return")); + assertThat(books) + .isNotEmpty() + .hasSize(1) + .extracting("title") + .contains("Javaslang in Spring Data Seq Return"); } @Test @@ -79,8 +82,8 @@ public class SpringTests { testBook.setAuthors(authors); JavaBook book = javaRepository.save(testBook); JavaBook retBook = javaRepository.findById(1L); - assert(retBook != null); - assert(retBook.getId() == 1L); - assert(retBook.getTitle().contains("Data")); + + assertThat(retBook.getId()).isEqualTo(1L); + assertThat(retBook.getTitle()).isEqualTo("Javaslang in Spring Data"); } } \ No newline at end of file