@Test
  public void testCache() throws Exception {

    // need to proxy out the constants.
    Constants cs =
        (Constants)
            Proxy.newProxyInstance(
                this.getClass().getClassLoader(),
                new Class[] {Constants.class},
                new ConstantsProxy());

    final SuggestionCompletionCache cache =
        new SuggestionCompletionCache(cs) {

          public void loadPackage(String packageName, Command command) {
            loaded = true;
          }
        };

    cache.doAction(
        "xyz",
        new Command() {
          public void execute() {}
        });
    assertTrue(loaded);

    SuggestionCompletionEngine eng = new SuggestionCompletionEngine();
    cache.cache.put("foo", eng);

    cache.doAction(
        "foo",
        new Command() {

          public void execute() {
            executed = true;
          }
        });

    assertTrue(executed);

    assertNotNull(cache.getEngineFromCache("foo"));

    cache.refreshPackage(
        "foo",
        new Command() {

          public void execute() {}
        });
  }
  @Test
  public void testCache() throws Exception {

    final SuggestionCompletionCache cache =
        new SuggestionCompletionCache() {

          public void loadPackage(String packageName, Command command) {
            loaded = true;
            command.execute();
          }
        };

    cache.loadPackage(
        "xyz",
        new Command() {
          public void execute() {}
        });
    assertTrue(loaded);

    SuggestionCompletionEngine eng = new SuggestionCompletionEngine();
    cache.cache.put("foo", eng);

    cache.loadPackage(
        "foo",
        new Command() {

          public void execute() {
            executed = true;
          }
        });

    assertTrue(executed);

    assertNotNull(cache.getEngineFromCache("foo"));

    cache.loadPackage(
        "foo",
        new Command() {

          public void execute() {}
        });
  }