JAVA-3520: Moved spring-mvc-basics-3 inside spring-web-modules
This commit is contained in:
+28
@@ -0,0 +1,28 @@
|
||||
package com.baeldung;
|
||||
|
||||
import com.baeldung.boot.Application;
|
||||
import com.baeldung.boot.domain.GenericEntity;
|
||||
import com.baeldung.boot.repository.GenericEntityRepository;
|
||||
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.SpringRunner;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = Application.class)
|
||||
public class SpringBootJPAIntegrationTest {
|
||||
@Autowired
|
||||
private GenericEntityRepository genericEntityRepository;
|
||||
|
||||
@Test
|
||||
public void givenGenericEntityRepository_whenSaveAndRetreiveEntity_thenOK() {
|
||||
GenericEntity genericEntity = genericEntityRepository.save(new GenericEntity("test"));
|
||||
GenericEntity foundEntity = genericEntityRepository.findById(genericEntity.getId()).orElse(null);
|
||||
assertNotNull(foundEntity);
|
||||
assertEquals(genericEntity.getValue(), foundEntity.getValue());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user