org.springframework.jdbc.core.test.ExtendedPerson Java Examples

The following examples show how to use org.springframework.jdbc.core.test.ExtendedPerson. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BeanPropertyRowMapperTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void testMappingWithUnpopulatedFieldsNotChecked() throws Exception {
	Mock mock = new Mock();
	List<ExtendedPerson> result = mock.getJdbcTemplate().query(
			"select name, age, birth_date, balance from people",
			new BeanPropertyRowMapper<>(ExtendedPerson.class));
	assertEquals(1, result.size());
	ExtendedPerson bean = result.get(0);
	verifyPerson(bean);
	mock.verifyClosed();
}
 
Example #2
Source File: BeanPropertyRowMapperTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void testMappingWithUnpopulatedFieldsNotAccepted() throws Exception {
	Mock mock = new Mock();
	assertThatExceptionOfType(InvalidDataAccessApiUsageException.class).isThrownBy(() ->
			mock.getJdbcTemplate().query("select name, age, birth_date, balance from people",
					new BeanPropertyRowMapper<>(ExtendedPerson.class, true)));
}
 
Example #3
Source File: BeanPropertyRowMapperTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void testMappingWithUnpopulatedFieldsNotChecked() throws Exception {
	Mock mock = new Mock();
	List<ExtendedPerson> result = mock.getJdbcTemplate().query(
			"select name, age, birth_date, balance from people",
			new BeanPropertyRowMapper<>(ExtendedPerson.class));
	assertEquals(1, result.size());
	ExtendedPerson bean = result.get(0);
	verifyPerson(bean);
	mock.verifyClosed();
}
 
Example #4
Source File: BeanPropertyRowMapperTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void testMappingWithUnpopulatedFieldsNotAccepted() throws Exception {
	Mock mock = new Mock();
	thrown.expect(InvalidDataAccessApiUsageException.class);
	mock.getJdbcTemplate().query(
			"select name, age, birth_date, balance from people",
			new BeanPropertyRowMapper<>(ExtendedPerson.class, true));
}
 
Example #5
Source File: BeanPropertyRowMapperTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void testMappingWithUnpopulatedFieldsNotChecked() throws Exception {
	Mock mock = new Mock();
	List<ExtendedPerson> result = mock.getJdbcTemplate().query(
			"select name, age, birth_date, balance from people",
			new BeanPropertyRowMapper<ExtendedPerson>(ExtendedPerson.class));
	assertEquals(1, result.size());
	ExtendedPerson bean = result.get(0);
	verifyConcretePerson(bean);
	mock.verifyClosed();
}
 
Example #6
Source File: BeanPropertyRowMapperTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void testMappingWithUnpopulatedFieldsNotAccepted() throws Exception {
	Mock mock = new Mock();
	thrown.expect(InvalidDataAccessApiUsageException.class);
	mock.getJdbcTemplate().query(
			"select name, age, birth_date, balance from people",
			new BeanPropertyRowMapper<ExtendedPerson>(ExtendedPerson.class, true));
}
 
Example #7
Source File: BeanPropertyRowMapperTests.java    From effectivejava with Apache License 2.0 5 votes vote down vote up
@Test
public void testMappingWithUnpopulatedFieldsNotChecked() throws Exception {
	Mock mock = new Mock();
	List<ExtendedPerson> result = mock.getJdbcTemplate().query(
			"select name, age, birth_date, balance from people",
			new BeanPropertyRowMapper<ExtendedPerson>(ExtendedPerson.class));
	assertEquals(1, result.size());
	ExtendedPerson bean = result.get(0);
	verifyConcretePerson(bean);
	mock.verifyClosed();
}
 
Example #8
Source File: BeanPropertyRowMapperTests.java    From effectivejava with Apache License 2.0 5 votes vote down vote up
@Test
public void testMappingWithUnpopulatedFieldsNotAccepted() throws Exception {
	Mock mock = new Mock();
	thrown.expect(InvalidDataAccessApiUsageException.class);
	mock.getJdbcTemplate().query(
			"select name, age, birth_date, balance from people",
			new BeanPropertyRowMapper<ExtendedPerson>(ExtendedPerson.class, true));
}