}
public void testParseAndEvaluate() throws Exception {
IMocksControl control = EasyMock.createControl();
CodebaseCreator cc = control.createMock(CodebaseCreator.class);
Editor e = control.createMock(Editor.class);
Editor translatorEditor = control.createMock(Editor.class);
File firstDir = new File("/first");
File secondDir = new File("/second");
File finalDir = new File("/final");
TranslatorPath tPath = new TranslatorPath("foo", "public");
Translator t = new ForwardTranslator(ImmutableList.<TranslatorStep>of(
new TranslatorStep("quux", translatorEditor)));
ProjectContext context = ProjectContext.builder()
.withRepositories(ImmutableMap.of("foo", new Repository("foo", null, cc, null)))
.withTranslators(ImmutableMap.of(tPath, t))
.withEditors(ImmutableMap.of("bar", e)).build();
Codebase firstCb = new Codebase(new File("/first"), "foo",
new RepositoryExpression(new Term("foo", EMPTY_MAP)));
Codebase secondCb = new Codebase(new File("/second"), "public",
new RepositoryExpression(new Term("foo2", EMPTY_MAP)));
Codebase finalCb = new Codebase(new File("/final"), "public",
new RepositoryExpression(new Term("foo3", EMPTY_MAP)));
expect(cc.create(EMPTY_MAP)).andReturn(firstCb);
expect(translatorEditor.edit(firstCb, context, EMPTY_MAP)).andReturn(secondCb);
expect(e.getDescription()).andReturn("");
expect(e.edit(secondCb, context, EMPTY_MAP)).andReturn(finalCb);
control.replay();
Codebase c = Parser.parseExpression("foo>public|bar").createCodebase(context);