RulesRepository repo = new RulesRepository(TestEnvironmentSessionHelper.getSession());
PackageItem item = repo.createPackage( "testLoader2", "to test the loader for fact templates" );
ServiceImplementation.updateDroolsHeader("import java.util.Date\ntemplate Person\njava.lang.String name\nDate birthDate\nend", item );
repo.save();
BRMSSuggestionCompletionLoader loader = new BRMSSuggestionCompletionLoader();
SuggestionCompletionEngine engine = loader.getSuggestionEngine( item );
assertNotNull(engine);
List<String> factTypes = Arrays.asList(engine.getFactTypes());
assertEquals( 2 + loader.getExternalImportDescrs().size(), factTypes.size() );
assertTrue(factTypes.contains("Date"));
assertTrue(factTypes.contains("Person"));
String[] fieldsForType = engine.getFieldCompletions( "Person" );
assertEquals( 2, fieldsForType.length );