StatefulKnowledgeSession ksession = getStatefulKnowledgeSession( ResourceFactory.newByteArrayResource( str.getBytes() ) );
setExec( ksession );
String outXml = execContent( "testInsertElementsWithReturnObjects.in.1" );
ExecutionResults result = unmarshalOutXml( outXml,
ExecutionResults.class );
List list1 = (List) result.getValue( "list1" );
assertEquals( 2,
list1.size() );
assertTrue( list1.contains( new Cheese( "stilton",
35 ) ) );
assertTrue( list1.contains( new Cheese( "stilton",
30 ) ) );
List myFacts = (List) result.getValue( "myfacts" );
assertEquals( 2,
list1.size() );
assertTrue( myFacts.contains( new Cheese( "stilton",
35 ) ) );
assertTrue( myFacts.contains( new Cheese( "stilton",
30 ) ) );
List<FactHandle> factHandles = (List<FactHandle>) result.getFactHandle( "myfacts" );
List list = new ArrayList();
list.add( ksession.getObject( ((InternalFactHandle) factHandles.get( 0 )) ) );
list.add( ksession.getObject( ((InternalFactHandle) factHandles.get( 1 )) ) );
assertTrue( list.contains( new Cheese( "stilton",
35 ) ) );