use of org.springframework.test.context.junit4.orm.domain.Person in project spring-framework-debug by Joker-5.
the class HibernateSessionFlushingTests method findSam.
@Test
public void findSam() {
Person sam = personService.findByName(SAM);
assertThat(sam).as("Should be able to find Sam").isNotNull();
DriversLicense driversLicense = sam.getDriversLicense();
assertThat(driversLicense).as("Sam's driver's license should not be null").isNotNull();
assertThat(driversLicense.getNumber()).as("Verifying Sam's driver's license number").isEqualTo(Long.valueOf(1234));
}
use of org.springframework.test.context.junit4.orm.domain.Person in project spring-framework-debug by Joker-5.
the class HibernateSessionFlushingTests method updateSamWithNullDriversLicense.
private void updateSamWithNullDriversLicense() {
Person sam = personService.findByName(SAM);
assertThat(sam).as("Should be able to find Sam").isNotNull();
sam.setDriversLicense(null);
personService.save(sam);
}
use of org.springframework.test.context.junit4.orm.domain.Person in project spring-framework-5.2.9.RELEASE by somepeopleHavingDream.
the class HibernateSessionFlushingTests method findSamWithReadOnlySession.
// SPR-16956
@Test
@Transactional(readOnly = true)
public void findSamWithReadOnlySession() {
Person sam = personService.findByName(SAM);
sam.setName("Vlad");
// By setting setDefaultReadOnly(true), the user can no longer modify any entity...
Session session = sessionFactory.getCurrentSession();
session.flush();
session.refresh(sam);
assertThat(sam.getName()).isEqualTo("Sam");
}
use of org.springframework.test.context.junit4.orm.domain.Person in project spring-framework-5.2.9.RELEASE by somepeopleHavingDream.
the class HibernateSessionFlushingTests method findSam.
@Test
public void findSam() {
Person sam = personService.findByName(SAM);
assertThat(sam).as("Should be able to find Sam").isNotNull();
DriversLicense driversLicense = sam.getDriversLicense();
assertThat(driversLicense).as("Sam's driver's license should not be null").isNotNull();
assertThat(driversLicense.getNumber()).as("Verifying Sam's driver's license number").isEqualTo(Long.valueOf(1234));
}
use of org.springframework.test.context.junit4.orm.domain.Person in project spring-framework-5.2.9.RELEASE by somepeopleHavingDream.
the class HibernateSessionFlushingTests method updateSamWithNullDriversLicense.
private void updateSamWithNullDriversLicense() {
Person sam = personService.findByName(SAM);
assertThat(sam).as("Should be able to find Sam").isNotNull();
sam.setDriversLicense(null);
personService.save(sam);
}
Aggregations