[BAEL-10128] Updated spring JPA article
This commit is contained in:
+2
@@ -3,6 +3,7 @@ package com.baeldung;
|
||||
import org.baeldung.config.PersistenceJPAConfigL2Cache;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import org.springframework.test.context.support.AnnotationConfigContextLoader;
|
||||
@@ -11,6 +12,7 @@ import org.springframework.test.context.web.WebAppConfiguration;
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration(classes = { PersistenceJPAConfigL2Cache.class }, loader = AnnotationConfigContextLoader.class)
|
||||
@WebAppConfiguration
|
||||
@DirtiesContext
|
||||
public class SpringContextIntegrationTest {
|
||||
|
||||
@Test
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ public class InMemoryDBIntegrationTest {
|
||||
Student student = new Student(ID, NAME);
|
||||
studentRepository.save(student);
|
||||
|
||||
Student student2 = studentRepository.findOne(ID);
|
||||
Student student2 = studentRepository.findById(ID).get();
|
||||
assertEquals("name incorrect", NAME, student2.getName());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user