01: package org.drools.brms.server.rules;
02:
03: import java.util.ArrayList;
04:
05: import junit.framework.TestCase;
06:
07: import org.drools.brms.client.modeldriven.SuggestionCompletionEngine;
08:
09: public class SuggestionCompletionLoaderTest extends TestCase {
10:
11: public void testSuggestionCompLoader() throws Exception {
12: SuggestionCompletionLoader loader = new SuggestionCompletionLoader();
13: SuggestionCompletionEngine eng = loader.getSuggestionEngine(
14: "package foo \n import org.drools.Person",
15: new ArrayList(), new ArrayList());
16: assertNotNull(eng);
17:
18: }
19:
20: public void testLoaderWithExistingClassloader() throws Exception {
21: MockClassLoader mcl = new MockClassLoader();
22: SuggestionCompletionLoader loader = new SuggestionCompletionLoader(
23: mcl);
24: SuggestionCompletionEngine eng = loader.getSuggestionEngine(
25: "package foo \n import org.foo.Bar", new ArrayList(),
26: new ArrayList());
27: assertNotNull(eng);
28: assertNotNull(eng.dataEnumLists);
29: assertTrue(mcl.called);
30:
31: }
32:
33: static class MockClassLoader extends ClassLoader {
34:
35: public boolean called = false;
36:
37: public Class loadClass(String name) {
38: called = true;
39: return Object.class;
40: }
41:
42: }
43:
44: }
|