use of org.apache.wicket.core.util.objects.checker.IObjectChecker in project wicket by apache.
the class JavaSerializerTest method notDetachedModel.
/**
* https://issues.apache.org/jira/browse/WICKET-4812
*
* Tests that the serialization fails when a checking ObjectOutputStream is
* used with NotDetachedModelChecker and there is a non-detached LoadableDetachableModel
* in the object tree.
*/
@Test
public void notDetachedModel() {
JavaSerializer serializer = new JavaSerializer("JavaSerializerTest") {
@Override
protected ObjectOutputStream newObjectOutputStream(OutputStream out) throws IOException {
IObjectChecker checker = new NotDetachedModelChecker();
return new CheckingObjectOutputStream(out, checker);
}
};
IModel<String> model = new NotDetachedModel();
model.getObject();
WebComponent component = new WebComponent("id", model);
byte[] serialized = serializer.serialize(component);
assertNull("The produced byte[] must be null if there was an error", serialized);
}
Aggregations