AnimalServiceTest.java 895 Bytes
package fr.plil.sio.examen;

import fr.plil.sio.examen.api.Owner;
import fr.plil.sio.examen.services.AnimalService;
import fr.plil.sio.examen.services.OwnerService;
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.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.transaction.annotation.Transactional;

@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest
@Transactional
public class AnimalServiceTest {
    
    @Autowired
    private AnimalService animalService;

    @Autowired
    private OwnerService ownerService;
    
    @Test
    public void createAnimalAndOwner() {
        Owner o = ownerService.create("owner");
        animalService.create("animal", o);        
    }
}