Resource baseResource = new ClasspathResource(loader, "baz/Biff.class");
Resource localized = baseResource.withExtension(InternalConstants.TEMPLATE_EXTENSION);
TemplateParser parser = mockTemplateParser();
ComponentTemplate template = mockComponentTemplate();
InvalidationListener listener = mockInvalidationListener();
train_getComponentClassName(model, "baz.Biff");
train_getBaseResource(model, baseResource);
train_parseTemplate(parser, localized, template);
replay();
ComponentTemplateSourceImpl source = new ComponentTemplateSourceImpl(parser, null);
source.addInvalidationListener(listener);
assertSame(source.getTemplate(model, Locale.ENGLISH), template);
// Check for updates (which won't be found).
source.checkForUpdates();
// A second pass will test the caching (the
// parser is not invoked).
assertSame(source.getTemplate(model, Locale.ENGLISH), template);
verify();
// Now, change the file and process an UpdateEvent.
touch(f);
listener.objectWasInvalidated();
replay();
// Check for updates (which will be found).
source.checkForUpdates();