Optimize build (#1582)
This commit is contained in:
parent
4d08f3db6d
commit
e7cc45644e
|
@ -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 {
|
1
pom.xml
1
pom.xml
|
@ -129,6 +129,7 @@
|
|||
<module>spring-data-couchbase-2</module>
|
||||
<module>spring-data-dynamodb</module>
|
||||
<module>spring-data-elasticsearch</module>
|
||||
<module>spring-data-javaslang</module>
|
||||
<module>spring-data-mongodb</module>
|
||||
<module>spring-data-neo4j</module>
|
||||
<module>spring-data-redis</module>
|
||||
|
|
|
@ -75,6 +75,12 @@
|
|||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>${maven-surefire-plugin.version}</version>
|
||||
<configuration>
|
||||
<excludes>
|
||||
<exclude>**/*IntegrationTest.java</exclude>
|
||||
<exclude>**/*LiveTest.java</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
|
|
|
@ -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(){
|
|
@ -1,8 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>spring-data-javaslangb</groupId>
|
||||
<artifactId>spring-data-javaslangb</artifactId>
|
||||
<groupId>spring-data-javaslang</groupId>
|
||||
<artifactId>spring-data-javaslang</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
@ -65,7 +65,18 @@
|
|||
<configuration>
|
||||
<testSourceDirectory>${project.build.testSourceDirectory}</testSourceDirectory>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugin> <plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>${maven-surefire-plugin.version}</version>
|
||||
<configuration>
|
||||
<excludes>
|
||||
<exclude>**/*IntegrationTest.java</exclude>
|
||||
<exclude>**/*LiveTest.java</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
|
|
|
@ -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<Seq<Book>> 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<Book> 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<JavaBook> 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");
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue