RuleExecutionServiceImpl implements RuleExecutionService { StatefulKnowledgeSession createStatefulKnowledgeSession() { StatefulKnowledgeSession session = null; try { final KnowledgeBuilder kbuilder = KnowledgeBuilderFactory .newKnowledgeBuilder(); final String casRules = guvnorService .getVersionedRulesFromPackage(); kbuilder.add( ResourceFactory.newByteArrayResource(casRules.getBytes()), ResourceType.DRL); final KnowledgeBuilderErrors errors = kbuilder.getErrors(); if (errors.size() > 0) { for (final KnowledgeBuilderError error : errors) { logger.error(error.toString()); } } final KnowledgeBase knowledgeBase = KnowledgeBaseFactory .newKnowledgeBase(); knowledgeBase.addKnowledgePackages(kbuilder.getKnowledgePackages()); session = knowledgeBase.newStatefulKnowledgeSession(); session.setGlobal("ruleExecutionContainer", new RuleExecutionContainer()); } catch (final Exception e) { logger.error(e.toString(), e); } return session; } RuleExecutionServiceImpl(GuvnorService guvnorService,
			SimpleMarshaller marshaller); @Override AssertAndExecuteClinicalFactsResponse assertAndExecuteClinicalFacts(
			FactModel factModel); @Override AssertAndExecuteClinicalFactsResponse assertAndExecuteClinicalFacts(
			String factModelXmlString);  }
@Test public void testCreateStatefulKnowledgeSession() throws IOException { String rulesMock = ResourceFileReader.getStringFromResourceFile("unitTestRules.txt"); when(guvnorServiceMock.getVersionedRulesFromPackage()).thenReturn( rulesMock); StatefulKnowledgeSession session = sut.createStatefulKnowledgeSession(); assertNotNull(session); }