Bael 113 (#3484)
* BAEL-399: A Guide to Multitenancy in Hibernate 5 * Removed unused properties in profile 2 * Changes after code review * BAEL-113 * Changes after code review * Added main method in spring boot application * Removed extra files
This commit is contained in:
committed by
KevinGilmore
parent
2781e27d1d
commit
ff76cbc1fe
@@ -0,0 +1,42 @@
|
||||
package com.baeldung.spring.jinq.repositories;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import com.baeldung.spring.jinq.JinqApplication;
|
||||
|
||||
@ContextConfiguration(classes = JinqApplication.class)
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
public class CarRepositoryIntegrationTest {
|
||||
|
||||
@Autowired
|
||||
private CarRepository repository;
|
||||
|
||||
@Test
|
||||
public void givenACar_whenFilter_thenShouldBeFound() {
|
||||
assertThat(repository.findByModel("model1")
|
||||
.isPresent()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenACar_whenMultipleFilters_thenShouldBeFound() {
|
||||
assertThat(repository.findByModelAndDescription("model1", "desc")
|
||||
.isEmpty()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenUseASelectClause() {
|
||||
assertThat(repository.findWithModelYearAndEngine()
|
||||
.isEmpty()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenUsingOneToOneRelationship() {
|
||||
assertThat(repository.findManufacturerByModel("model1")).isNotNull();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user