<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Mock classes?<br>
<br>
vdelbart wrote:
<blockquote cite="mid:16939583.post@talk.nabble.com" type="cite">
<pre wrap="">I create a JIRA : <a class="moz-txt-link-freetext" href="http://jira.jboss.com/jira/browse/JBRULES-1590">http://jira.jboss.com/jira/browse/JBRULES-1590</a>
it's to complicate to me to create an unit test with a hibernate session.
thanks,
V.
Mark Proctor wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Can you open a JIRA for this? If you provide a unit test with it, we'll
see if we can include this in 4.0.7. 5.0 will now have shadow proxies
any more, as default.
Mark
vdelbart wrote:
</pre>
<blockquote type="cite">
<pre wrap="">I think the method cloneObject 'ShadowProxyUtils' could be improve like
follow :
public static Object cloneObject(Object original) {
Object clone = null;
if ( original instanceof Cloneable ) {
try {
Method cloneMethod = original.getClass().getMethod(
"clone",
new
Class[0] );
clone = cloneMethod.invoke( original,
new Object[0] );
} catch ( Exception e ) {
/* Failed to clone. Don't worry about it, and just
return
* the original object. */
clone = null;
}
}
if ( clone == null ) {
try {
if ( original instanceof Map &&
original != Collections.EMPTY_MAP &&
!UNMODIFIABLE_MAP.isAssignableFrom(
original.getClass()
) ) {
/* empty and unmodifiable maps can't (and don't need
to)
be shadowed */
clone = original.getClass().newInstance();
((Map) clone).putAll( (Map) original );
} else if ( original instanceof Collection &&
original != Collections.EMPTY_LIST &&
original != Collections.EMPTY_SET &&
!UNMODIFIABLE_COLLECTION.isAssignableFrom(
original.getClass() ) ) {
/* empty and unmodifiable collections can't (and
don't
need to) be shadowed */
clone = original.getClass().newInstance();
((Collection) clone).addAll( (Collection) original );
} else if ( original.getClass().isArray() ) {
clone = cloneArray( original );
}
} catch ( Exception e ) {
/* Failed to clone. Don't worry about it, and just
return
* the original object. */
clone = null;
}
}
if ( clone == null ) {
clone = original;
}
return clone;
}
In this way my PersistentSet will be not clone and I will be able to
continue to use shadow fact
What do you think about ?
V.
</pre>
</blockquote>
<pre wrap="">_______________________________________________
rules-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a>
</pre>
</blockquote>
<pre wrap=""><!---->
</pre>
</blockquote>
<br>
</body>
</html>