str += "end\n";
StatefulKnowledgeSession ksession = getStatefulKnowledgeSession( ResourceFactory.newByteArrayResource( str.getBytes() ) );
setExec( ksession );
FactHandle fh = ksession.insert( new Person( "mic",
42 ) );
List<FactHandle> list = new ArrayList<FactHandle>();
list.add( fh );
ksession.setGlobal( "list1",
list );
String outXml = execContent( "testFactHandleReturn.in.1" );
assertXMLEqual( getContent( "testFactHandleReturn.expected.1",
fh.toExternalForm() ),
outXml );
ExecutionResults result = unmarshalOutXml( outXml,
ExecutionResults.class );
List outList = (List) result.getValue( "out-list" );
assertEquals( 1,
outList.size() );
assertEquals( fh.toExternalForm(),
((FactHandle) outList.get( 0 )).toExternalForm() );
assertNotSame( fh,
outList.get( 0 ) );
}