DbParameterAccessor { public void set(Object value) throws Exception { if (direction == OUTPUT || direction == RETURN_VALUE) { throw new UnsupportedOperationException("Trying to set value of output parameter " + name); } cs.setObject(index, toJdbcCompatibleValue(value), sqlType, userDefinedTypeName); } @SuppressWarnings("unchecked")  DbParameterAccessor(String name, Direction direction, int sqlType, Class javaType, int position,
                               TypeTransformerFactory dbfitToJdbcTransformerFactory);  DbParameterAccessor(String name, Direction direction, int sqlType, String userDefinedTypeName, Class javaType, int position,
                               TypeTransformerFactory dbfitToJdbcTransformerFactory); @Override DbParameterAccessor clone(); String getUserDefinedTypeName(); Direction getDirection(); String getName(); void setDirection(Direction direction); void bindTo(StatementExecution cs, int ind); void set(Object value); Object get(); int getPosition(); Class<?> getJavaType(); boolean isReturnValueAccessor(); boolean hasDirection(Direction expectedDirection); boolean doesNotHaveDirection(Direction expectedDirection);  }
@Test public void inputObjectIsTransformedBeforeJdbcBindingWhenTransformerSpecifierTest() throws Exception { TypeTransformer inputTransformer = mock(TypeTransformer.class); Integer outputValue = 5; when(inputTransformer.transform(inputValue)).thenReturn(outputValue); when(inputTransformerFactory.getTransformer(inputValue.getClass())).thenReturn(inputTransformer); dbpa.set(inputValue); verify(statement).setObject(position, outputValue, sqlType, userDefinedTypeName); }
@Test public void inputObjectIsNotTransformedBeforeJdbcBindingWhenNoTransformerSpecifierTest() throws Exception { when(inputTransformerFactory.getTransformer(inputValue.getClass())).thenReturn(null); dbpa.set(inputValue); verify(statement).setObject(position, inputValue, sqlType, userDefinedTypeName); }