Skip to content

Commit

Permalink
Fixing model-impl tests
Browse files Browse the repository at this point in the history
  • Loading branch information
semancik committed Apr 1, 2019
1 parent 285874e commit e504f49
Show file tree
Hide file tree
Showing 6 changed files with 165 additions and 182 deletions.
Expand Up @@ -79,18 +79,18 @@ public TypedValue get(Object key) {

public TypedValue put(String key, TypedValue typedValue) {
if (typedValue == null) {
throw new IllegalArgumentException("Attempt to set variable '"+key+"' with null typed value");
throw new IllegalArgumentException("Attempt to set variable '"+key+"' with null typed value: "+typedValue);
}
if (!typedValue.canDetermineType()) {
throw new IllegalArgumentException("Attempt to set variable '"+key+"' without determinable type");
throw new IllegalArgumentException("Attempt to set variable '"+key+"' without determinable type: "+typedValue);
}
return variables.put(key, typedValue);
}

@SuppressWarnings("rawtypes")
public <D extends ItemDefinition> TypedValue put(String key, Object value, D definition) {
if (definition == null) {
throw new IllegalArgumentException("Attempt to set variable '"+key+"' without definition");
throw new IllegalArgumentException("Attempt to set variable '"+key+"' without definition: " + value);
}
return variables.put(key, new TypedValue<>(value, definition));
}
Expand All @@ -102,7 +102,7 @@ public <D extends ItemDefinition> TypedValue put(String key, Object value, D def
*/
public <T> TypedValue put(String key, Object value, Class<T> typeClass) {
if (typeClass == null) {
throw new IllegalArgumentException("Attempt to set variable '"+key+"' without class specification");
throw new IllegalArgumentException("Attempt to set variable '"+key+"' without class specification: " + value);
}
return variables.put(key, new TypedValue<>(value, typeClass));
}
Expand Down
Expand Up @@ -213,7 +213,7 @@ public static <T> TypedValue<T> cloneIfNecessary(String name, TypedValue<T> valu
if (valueClone == valueAndDef.getValue()) {
return valueAndDef;
} else {
return new TypedValue<T>(valueClone, (ItemDefinition)valueAndDef.getDefinition());
return valueAndDef.createTransformed(valueClone);
}
}

Expand Down

0 comments on commit e504f49

Please sign in to comment.