2017-04-20 01:49:09 +03:00
|
|
|
package com.baeldung.autoconfiguration;
|
|
|
|
|
|
2017-07-21 13:37:49 +03:00
|
|
|
import com.baeldung.autoconfiguration.example.AutoconfigurationApplication;
|
|
|
|
|
import com.baeldung.autoconfiguration.example.MyUser;
|
|
|
|
|
import com.baeldung.autoconfiguration.example.MyUserRepository;
|
2017-04-20 01:49:09 +03:00
|
|
|
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.data.jpa.repository.config.EnableJpaRepositories;
|
|
|
|
|
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
|
|
|
|
|
|
|
|
|
@RunWith(SpringJUnit4ClassRunner.class)
|
|
|
|
|
@SpringBootTest(classes = AutoconfigurationApplication.class)
|
2017-08-24 13:11:52 +03:00
|
|
|
@EnableJpaRepositories(basePackages = { "com.baeldung.autoconfiguration.example" })
|
2017-05-15 18:35:14 +02:00
|
|
|
public class AutoconfigurationIntegrationTest {
|
2017-04-20 01:49:09 +03:00
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private MyUserRepository userRepository;
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void whenSaveUser_thenOk() {
|
|
|
|
|
MyUser user = new MyUser("user@email.com");
|
|
|
|
|
userRepository.save(user);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|