@Test public void should_keep_current_type_if_no_override() throws Exception { assertSame(String.class , resolver.determineFinalTypeOfCurrentExpressionAnd("property", String.class)); assertSame(URL.class , resolver.determineFinalTypeOfCurrentExpressionAnd("property", URL.class)); }
Class<?> determineFinalTypeOfCurrentExpressionAnd(final Object property, final Class<?> originalType) { Class<?> override = getTypeOverride(property); Class<?> type; if (override != null) { type = override; log.fine("getValue(prop=" + property + ",currentExpr.=" + currentExpression + "): overriding " + originalType + " with " + type + " as requested"); } else { type = originalType; } if (type == null) { type = MockObjectOfUnknownType.class; } return type; }
MockingPropertyResolver implements PredefinedVariableResolver.NewVariableEncounteredListener { Class<?> determineFinalTypeOfCurrentExpressionAnd(final Object property, final Class<?> originalType) { Class<?> override = getTypeOverride(property); Class<?> type; if (override != null) { type = override; log.fine("getValue(prop=" + property + ",currentExpr.=" + currentExpression + "): overriding " + originalType + " with " + type + " as requested"); } else { type = originalType; } if (type == null) { type = MockObjectOfUnknownType.class; } return type; } }
MockingPropertyResolver implements PredefinedVariableResolver.NewVariableEncounteredListener { Class<?> determineFinalTypeOfCurrentExpressionAnd(final Object property, final Class<?> originalType) { Class<?> override = getTypeOverride(property); Class<?> type; if (override != null) { type = override; log.fine("getValue(prop=" + property + ",currentExpr.=" + currentExpression + "): overriding " + originalType + " with " + type + " as requested"); } else { type = originalType; } if (type == null) { type = MockObjectOfUnknownType.class; } return type; } MockingPropertyResolver(); }
MockingPropertyResolver implements PredefinedVariableResolver.NewVariableEncounteredListener { Class<?> determineFinalTypeOfCurrentExpressionAnd(final Object property, final Class<?> originalType) { Class<?> override = getTypeOverride(property); Class<?> type; if (override != null) { type = override; log.fine("getValue(prop=" + property + ",currentExpr.=" + currentExpression + "): overriding " + originalType + " with " + type + " as requested"); } else { type = originalType; } if (type == null) { type = MockObjectOfUnknownType.class; } return type; } MockingPropertyResolver(); void definePropertyTypeOverride(final String elExpression, final Class<?> newType); Class<?> getTypeOfCollectionOrBean(Object target, Object property); Object getValue(Object target, Object property); @SuppressWarnings("rawtypes") Object getValue(final Object target, final Object property, final Class originalType); void handleNewVariableEncountered(final String variableName); void addElExpressionFilter(ElExpressionFilter elExpressionFilter); void clearElExpressionFilters(); void setTypeResolver(PropertyTypeResolver typeResolver); }
MockingPropertyResolver implements PredefinedVariableResolver.NewVariableEncounteredListener { Class<?> determineFinalTypeOfCurrentExpressionAnd(final Object property, final Class<?> originalType) { Class<?> override = getTypeOverride(property); Class<?> type; if (override != null) { type = override; log.fine("getValue(prop=" + property + ",currentExpr.=" + currentExpression + "): overriding " + originalType + " with " + type + " as requested"); } else { type = originalType; } if (type == null) { type = MockObjectOfUnknownType.class; } return type; } MockingPropertyResolver(); void definePropertyTypeOverride(final String elExpression, final Class<?> newType); Class<?> getTypeOfCollectionOrBean(Object target, Object property); Object getValue(Object target, Object property); @SuppressWarnings("rawtypes") Object getValue(final Object target, final Object property, final Class originalType); void handleNewVariableEncountered(final String variableName); void addElExpressionFilter(ElExpressionFilter elExpressionFilter); void clearElExpressionFilters(); void setTypeResolver(PropertyTypeResolver typeResolver);  }