use of org.springframework.data.mongodb.examples.custsvc.domain.Customer in project spring-data-document-examples by spring-projects.
the class CustomerRepositoryTests method testInsertOneEntity.
@Transactional
@Rollback(false)
@Test
public void testInsertOneEntity() {
Customer c = new Customer();
c.setFirstName("Sven");
c.setLastName("Olafsen");
SurveyInfo surveyInfo = new SurveyInfo();
Map<String, String> qAndA = new HashMap<String, String>();
qAndA.put("age", "22");
qAndA.put("married", "Yes");
qAndA.put("citizenship", "Norwegian");
surveyInfo.setQuestionsAndAnswers(qAndA);
c.setSurveyInfo(surveyInfo);
customerRepository.save(c);
Assert.assertNotNull(c.getId());
idUsed = c.getId();
}
use of org.springframework.data.mongodb.examples.custsvc.domain.Customer in project spring-data-document-examples by spring-projects.
the class CustomerRepositoryTests method testDeleteOneEntity.
@Transactional
@Rollback(false)
@Test
public void testDeleteOneEntity() {
Customer c = customerRepository.findOne(idUsed);
customerRepository.delete(c);
}
use of org.springframework.data.mongodb.examples.custsvc.domain.Customer in project spring-data-document-examples by spring-projects.
the class CustomerRepositoryTests method testCheckOneEntityIsGone.
@Transactional
@Rollback(false)
@Test
public void testCheckOneEntityIsGone() {
Customer c = customerRepository.findOne(idUsed);
Assert.assertNull(c);
}
use of org.springframework.data.mongodb.examples.custsvc.domain.Customer in project spring-data-document-examples by spring-projects.
the class CustomerRepositoryTests method testUpdateOneEntity.
@Transactional
@Rollback(false)
@Test
public void testUpdateOneEntity() {
Customer c = customerRepository.findOne(idUsed);
Assert.assertNotNull(c);
c.setLastName("Nilsson");
}
use of org.springframework.data.mongodb.examples.custsvc.domain.Customer in project spring-data-document-examples by spring-projects.
the class CustomerRepositoryTests method testCheckOneEntity.
@Transactional
@Rollback(false)
@Test
public void testCheckOneEntity() {
Customer c = customerRepository.findOne(idUsed);
Assert.assertNotNull(c);
Assert.assertEquals("Nilsson", c.getLastName());
}
Aggregations