use of org.springframework.data.jdbc.mybatis.MyBatisContext in project spring-data-jdbc by spring-projects.
the class MyBatisDataAccessStrategyUnitTests method findAllByProperty.
@SuppressWarnings("unchecked")
// DATAJDBC-123
@Test
public void findAllByProperty() {
JdbcPersistentProperty property = mock(JdbcPersistentProperty.class, Mockito.RETURNS_DEEP_STUBS);
when(property.getOwner().getType()).thenReturn((Class) String.class);
doReturn(Number.class).when(property).getType();
doReturn("propertyName").when(property).getName();
accessStrategy.findAllByProperty("id", property);
verify(session).selectList(eq("java.lang.StringMapper.findAllByProperty-propertyName"), captor.capture());
//
assertThat(captor.getValue()).isNotNull().extracting(//
MyBatisContext::getInstance, //
MyBatisContext::getId, //
MyBatisContext::getDomainType, //
c -> c.get("key")).containsExactly(//
null, //
"id", //
Number.class, //
null);
}
Aggregations