forked from DevFW-CICD/spring-petclinic
made sure @Transactional is not set on the Repository layer
This commit is contained in:
parent
4e91b4468e
commit
c5ca72e80b
6 changed files with 6 additions and 22 deletions
|
|
@ -80,16 +80,14 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
* @author Rod Johnson
|
||||
* @author Juergen Hoeller
|
||||
* @author Sam Brannen
|
||||
* * @author Michael Isvy
|
||||
*/
|
||||
public abstract class AbstractOwnerRepositoryTests {
|
||||
|
||||
@Autowired
|
||||
protected OwnerRepository ownerRepository;
|
||||
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
@Test @Transactional
|
||||
public void findOwners() {
|
||||
Collection<Owner> owners = this.ownerRepository.findByLastName("Davis");
|
||||
assertEquals(2, owners.size());
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ public abstract class AbstractPetRepositoryTests {
|
|||
protected OwnerRepository ownerRepository;
|
||||
|
||||
|
||||
@Test
|
||||
@Test @Transactional
|
||||
public void getPetTypes() {
|
||||
Collection<PetType> petTypes = this.petRepository.findPetTypes();
|
||||
|
||||
|
|
@ -106,7 +106,7 @@ public abstract class AbstractPetRepositoryTests {
|
|||
assertEquals("snake", petType4.getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test @Transactional
|
||||
public void findPet() {
|
||||
Collection<PetType> types = this.petRepository.findPetTypes();
|
||||
Pet pet7 = this.petRepository.findById(7);
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import static org.junit.Assert.assertNull;
|
|||
import org.junit.Test;
|
||||
import org.springframework.samples.petclinic.model.Owner;
|
||||
import org.springframework.samples.petclinic.model.Pet;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* JUnit test for the {@link Owner} class.
|
||||
|
|
@ -14,7 +15,7 @@ import org.springframework.samples.petclinic.model.Pet;
|
|||
*/
|
||||
public class OwnerTests {
|
||||
|
||||
@Test
|
||||
@Test @Transactional
|
||||
public void testHasPet() {
|
||||
Owner owner = new Owner();
|
||||
Pet fido = new Pet();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue