Converted formatter tests from functional tests to unit tests.
diff --git a/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/formatting/CommentReaderRule.java b/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/formatting/CommentReaderRule.java
new file mode 100644
index 0000000..c1ed17f
--- /dev/null
+++ b/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/formatting/CommentReaderRule.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2011 Google Inc.
+ *
+ * All rights reserved. This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ */
+package com.google.eclipse.protobuf.formatting;
+
+import java.util.List;
+
+import org.eclipse.xtext.ISetup;
+import org.eclipse.xtext.nodemodel.ICompositeNode;
+import org.eclipse.xtext.parser.IParseResult;
+import org.junit.rules.MethodRule;
+import org.junit.runners.model.*;
+
+import com.google.eclipse.protobuf.junit.core.*;
+import com.google.inject.*;
+
+/**
+ * @author alruiz@google.com (Alex Ruiz)
+ */
+class CommentReaderRule implements MethodRule {
+  private final Injector injector;
+
+  private final CommentReader commentReader;
+  private final ProtoParser protoParser;
+
+  private ICompositeNode rootNode;
+  private String expectedText;
+
+  static CommentReaderRule overrideRuntimeModuleWith(Module...testModules) {
+    ISetup setup = new OverrideRuntimeModuleSetup(testModules);
+    Injector injector = setup.createInjectorAndDoEMFRegistration();
+    return new CommentReaderRule(injector);
+  }
+
+  private CommentReaderRule(Injector injector) {
+    this.injector = injector;
+    commentReader = new CommentReader();
+    protoParser = new ProtoParser(injector);
+  }
+
+  @Override public Statement apply(Statement base, FrameworkMethod method, Object target) {
+    injector.injectMembers(target);
+    rootNode = null;
+    List<String> comments = commentReader.commentsIn(method);
+    if (comments.size() == 2) {
+      parseText(comments.get(0));
+      expectedText = comments.get(1);
+    }
+    return base;
+  }
+
+  void parseText(String text) {
+    IParseResult parseResult = protoParser.parseText(text);
+    rootNode = parseResult.getRootNode();
+  }
+
+  ICompositeNode rootNode() {
+    return rootNode;
+  }
+
+  String expectedText() {
+    return expectedText;
+  }
+}
diff --git a/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/formatting/ProtobufFormatter_Test.java b/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/formatting/ProtobufFormatter_Test.java
new file mode 100644
index 0000000..d518334
--- /dev/null
+++ b/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/formatting/ProtobufFormatter_Test.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2012 Google Inc.
+ *
+ * All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse
+ * Public License v1.0 which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ */
+package com.google.eclipse.protobuf.formatting;
+
+import static com.google.eclipse.protobuf.formatting.CommentReaderRule.overrideRuntimeModuleWith;
+import static com.google.eclipse.protobuf.junit.core.UnitTestModule.unitTestModule;
+import static org.hamcrest.core.IsEqual.equalTo;
+import static org.junit.Assert.assertThat;
+
+import org.eclipse.xtext.formatting.*;
+import org.eclipse.xtext.formatting.INodeModelFormatter.IFormattedRegion;
+import org.eclipse.xtext.nodemodel.ICompositeNode;
+import org.junit.*;
+
+import com.google.inject.Inject;
+
+/**
+ * @Tests for <code>{@link ProtobufFormatter}</code>.
+ *
+ * @author alruiz@google.com (Alex Ruiz)
+ */
+public class ProtobufFormatter_Test {
+  @Rule public CommentReaderRule commentReader = overrideRuntimeModuleWith(unitTestModule());
+
+  @Inject private INodeModelFormatter formatter;
+
+  // syntax = 'proto2';import 'google/protobuf/descriptor.proto';
+
+  // syntax = 'proto2';
+  //
+  // import 'google/protobuf/descriptor.proto';
+  @Test public void should_format_syntax() {
+    assertThat(formatText(), equalTo(commentReader.expectedText()));
+  }
+
+  // package com.google.proto.test;import 'google/protobuf/descriptor.proto';
+
+  // package com.google.proto.test;
+  //
+  // import 'google/protobuf/descriptor.proto';
+  @Test public void should_format_package() {
+    assertThat(formatText(), equalTo(commentReader.expectedText()));
+  }
+
+  // import 'dummy.proto';import 'google/protobuf/descriptor.proto';
+
+  // import 'dummy.proto';
+  // import 'google/protobuf/descriptor.proto';
+  @Test public void should_format_normal_import() {
+    assertThat(formatText(), equalTo(commentReader.expectedText()));
+  }
+
+  // import public 'dummy.proto';import 'google/protobuf/descriptor.proto';
+
+  // import public 'dummy.proto';
+  // import 'google/protobuf/descriptor.proto';
+  @Test public void should_format_public_import() {
+    assertThat(formatText(), equalTo(commentReader.expectedText()));
+  }
+
+  // import weak 'dummy.proto';import 'google/protobuf/descriptor.proto';
+
+  // import weak 'dummy.proto';
+  // import 'google/protobuf/descriptor.proto';
+  @Test public void should_format_weak_import() {
+    assertThat(formatText(), equalTo(commentReader.expectedText()));
+  }
+
+  // option java_package = "com.foo.bar";option optimize_for = CODE_SIZE;
+
+  // option java_package = "com.foo.bar";
+  // option optimize_for = CODE_SIZE;
+  @Test public void should_format_native_option() {
+    assertThat(formatText(), equalTo(commentReader.expectedText()));
+  }
+
+  private String formatText() {
+    ICompositeNode rootNode = commentReader.rootNode();
+    IFormattedRegion region = formatter.format(rootNode, 0, rootNode.getText().length());
+    return region.getFormattedText();
+  }
+}
diff --git a/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/junit/core/CommentReader.java b/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/junit/core/CommentReader.java
index 793dee2..282fa48 100644
--- a/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/junit/core/CommentReader.java
+++ b/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/junit/core/CommentReader.java
@@ -48,11 +48,11 @@
     if (initialized) {
       return;
     }
-    doReadComments(testClass);
+    readComments(testClass);
     initialized = true;
   }
 
-  private void doReadComments(Class<?> testClass) {
+  private void readComments(Class<?> testClass) {
     String fqn = testClass.getName().replace('.', '/');
     fqn = fqn.indexOf("$") == -1 ? fqn : fqn.substring(0, fqn.indexOf("$"));
     String classFile = fqn + ".java";
diff --git a/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/junit/core/CommentProcessor.java b/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/junit/core/FileCreator.java
similarity index 94%
rename from com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/junit/core/CommentProcessor.java
rename to com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/junit/core/FileCreator.java
index 6784a27..bdd317d 100644
--- a/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/junit/core/CommentProcessor.java
+++ b/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/junit/core/FileCreator.java
@@ -18,17 +18,17 @@
 /**
  * @author alruiz@google.com (Alex Ruiz)
  */
-class CommentProcessor {
+class FileCreator {
   private static final Pattern CREATE_FILE_PATTERN = compile("// Create file (.*)");
 
-  Object processComment(String comment) {
+  File createFileFrom(String comment) {
     Scanner scanner = new Scanner(comment);
     String fileName = null;
     while (scanner.hasNextLine()) {
       String line = scanner.nextLine();
       Matcher matcher = CREATE_FILE_PATTERN.matcher(line);
       if (!matcher.matches()) {
-        return comment;
+        return null;
       }
       fileName = matcher.group(1);
       break;
diff --git a/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/junit/core/OverrideRuntimeModuleSetup.java b/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/junit/core/OverrideRuntimeModuleSetup.java
index 4b4c065..8872a19 100644
--- a/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/junit/core/OverrideRuntimeModuleSetup.java
+++ b/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/junit/core/OverrideRuntimeModuleSetup.java
@@ -20,7 +20,7 @@
 public class OverrideRuntimeModuleSetup extends ProtobufStandaloneSetup {
   private final Module[] modules;
 
-  OverrideRuntimeModuleSetup(Module[] modules) {
+  public OverrideRuntimeModuleSetup(Module[] modules) {
     this.modules = copyOf(modules, modules.length);
   }
 
diff --git a/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/junit/core/ProtoParser.java b/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/junit/core/ProtoParser.java
new file mode 100644
index 0000000..9bb9904
--- /dev/null
+++ b/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/junit/core/ProtoParser.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2012 Google Inc.
+ *
+ * All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse
+ * Public License v1.0 which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ */
+package com.google.eclipse.protobuf.junit.core;
+
+import static com.google.eclipse.protobuf.util.SystemProperties.lineSeparator;
+import static org.eclipse.emf.common.util.URI.createURI;
+import static org.eclipse.emf.ecore.util.EcoreUtil.resolveAll;
+import static org.eclipse.xtext.util.CancelIndicator.NullImpl;
+
+import java.io.*;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.xtext.linking.lazy.LazyLinkingResource;
+import org.eclipse.xtext.nodemodel.INode;
+import org.eclipse.xtext.parser.IParseResult;
+import org.eclipse.xtext.resource.*;
+import org.eclipse.xtext.util.StringInputStream;
+
+import com.google.inject.Injector;
+
+/**
+ * @author alruiz@google.com (Alex Ruiz)
+ */
+public class ProtoParser {
+  private final Injector injector;
+
+  public ProtoParser(Injector injector) {
+    this.injector = injector;
+  }
+
+  public IParseResult parseText(String text) {
+    boolean ignoreSyntaxErrors = shouldIgnoreSyntaxErrorsIn(text);
+    XtextResource resource = createResourceFrom(new StringInputStream(text));
+    IParseResult parseResult = resource.getParseResult();
+    if (ignoreSyntaxErrors || !parseResult.hasSyntaxErrors()) {
+      return parseResult;
+    }
+    StringBuilder builder = new StringBuilder();
+    builder.append("Syntax errors:");
+    for (INode error : parseResult.getSyntaxErrors()) {
+      builder.append(lineSeparator()).append("- ").append(error.getSyntaxErrorMessage());
+    }
+    throw new IllegalStateException(builder.toString());
+  }
+
+  private boolean shouldIgnoreSyntaxErrorsIn(String text) {
+    return text.startsWith("// ignore errors");
+  }
+
+  private XtextResource createResourceFrom(InputStream input) {
+    return createResourceFrom(input, createURI("file:/usr/local/project/src/protos/mytestmodel.proto"));
+  }
+
+  private XtextResource createResourceFrom(InputStream input, URI uri) {
+    XtextResourceSet resourceSet = getInstanceOf(XtextResourceSet.class);
+    resourceSet.setClasspathURIContext(getClass());
+    XtextResource resource = (XtextResource) getInstanceOf(IResourceFactory.class).createResource(uri);
+    resourceSet.getResources().add(resource);
+    try {
+      resource.load(input, null);
+    } catch (IOException e) {
+      throw new RuntimeException(e);
+    }
+    if (resource instanceof LazyLinkingResource) {
+      ((LazyLinkingResource) resource).resolveLazyCrossReferences(NullImpl);
+      return resource;
+    }
+    resolveAll(resource);
+    return resource;
+  }
+
+  private <T> T getInstanceOf(Class<T> type) {
+    return injector.getInstance(type);
+  }
+}
diff --git a/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/junit/core/XtextRule.java b/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/junit/core/XtextRule.java
index 55e1df1..d296162 100644
--- a/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/junit/core/XtextRule.java
+++ b/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/junit/core/XtextRule.java
@@ -9,24 +9,17 @@
  */
 package com.google.eclipse.protobuf.junit.core;
 
-import static com.google.eclipse.protobuf.util.SystemProperties.lineSeparator;
 import static java.util.Arrays.asList;
-import static org.eclipse.emf.common.util.URI.createURI;
-import static org.eclipse.emf.ecore.util.EcoreUtil.resolveAll;
-import static org.eclipse.xtext.util.CancelIndicator.NullImpl;
 import static org.eclipse.xtext.util.Strings.isEmpty;
 
-import java.io.*;
+import java.io.File;
 import java.util.List;
 
-import org.eclipse.emf.common.util.URI;
 import org.eclipse.emf.ecore.EObject;
 import org.eclipse.xtext.*;
-import org.eclipse.xtext.linking.lazy.LazyLinkingResource;
-import org.eclipse.xtext.nodemodel.*;
+import org.eclipse.xtext.nodemodel.ILeafNode;
 import org.eclipse.xtext.parser.IParseResult;
-import org.eclipse.xtext.resource.*;
-import org.eclipse.xtext.util.StringInputStream;
+import org.eclipse.xtext.resource.XtextResource;
 import org.junit.rules.MethodRule;
 import org.junit.runners.model.*;
 
@@ -47,8 +40,10 @@
  */
 public class XtextRule implements MethodRule {
   private final Injector injector;
-  private final CommentProcessor processor;
-  private final CommentReader reader;
+
+  private final CommentReader commentReader;
+  private final FileCreator fileCreator;
+  private final ProtoParser protoParser;
 
   private Protobuf root;
   private XtextResource resource;
@@ -68,8 +63,9 @@
 
   private XtextRule(Injector injector) {
     this.injector = injector;
-    processor = new CommentProcessor();
-    reader = new CommentReader();
+    commentReader = new CommentReader();
+    fileCreator = new FileCreator();
+    protoParser = new ProtoParser(injector);
   }
 
   @Override public Statement apply(Statement base, FrameworkMethod method, Object target) {
@@ -84,65 +80,22 @@
   }
 
   private String commentsIn(FrameworkMethod method) {
-    for (String comment : reader.commentsIn(method)) {
-      Object processed = processor.processComment(comment);
-      if (processed instanceof String) {
-        return (String) processed;
+    for (String comment : commentReader.commentsIn(method)) {
+      File protoFile = fileCreator.createFileFrom(comment);
+      if (protoFile == null) {
+        return comment;
       }
     }
     return null;
   }
 
   public void parseText(String text) {
-    boolean ignoreSyntaxErrors = shouldIgnoreSyntaxErrorsIn(text);
-    resource = createResourceFrom(new StringInputStream(text));
-    IParseResult parseResult = resource.getParseResult();
+    IParseResult parseResult = protoParser.parseText(text);
     root = (Protobuf) parseResult.getRootASTElement();
-    if (ignoreSyntaxErrors) {
-      return;
+    if (root.getSyntax() == null) {
+      throw new IllegalStateException("Please specify 'proto2' syntax");
     }
-    if (!parseResult.hasSyntaxErrors()) {
-      if (root.getSyntax() == null) {
-        throw new IllegalStateException("Please specify 'proto2' syntax");
-      }
-      return;
-    }
-    StringBuilder builder = new StringBuilder();
-    builder.append("Syntax errors:");
-    for (INode error : parseResult.getSyntaxErrors()) {
-      builder.append(lineSeparator()).append("- ").append(error.getSyntaxErrorMessage());
-    }
-    throw new IllegalStateException(builder.toString());
-  }
-
-  private boolean shouldIgnoreSyntaxErrorsIn(String text) {
-    return text.startsWith("// ignore errors");
-  }
-
-  private XtextResource createResourceFrom(InputStream input) {
-    return createResourceFrom(input, createURI("file:/usr/local/project/src/protos/mytestmodel.proto"));
-  }
-
-  private XtextResource createResourceFrom(InputStream input, URI uri) {
-    XtextResourceSet resourceSet = getInstanceOf(XtextResourceSet.class);
-    resourceSet.setClasspathURIContext(getClass());
-    XtextResource resource = (XtextResource) getInstanceOf(IResourceFactory.class).createResource(uri);
-    resourceSet.getResources().add(resource);
-    try {
-      resource.load(input, null);
-    } catch (IOException e) {
-      throw new RuntimeException(e);
-    }
-    if (resource instanceof LazyLinkingResource) {
-      ((LazyLinkingResource) resource).resolveLazyCrossReferences(NullImpl);
-      return resource;
-    }
-    resolveAll(resource);
-    return resource;
-  }
-
-  private <T> T getInstanceOf(Class<T> type) {
-    return injector.getInstance(type);
+    resource = (XtextResource) root.eResource();
   }
 
   public Injector injector() {
diff --git a/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/junit/util/MultiLineTextBuilder.java b/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/junit/util/MultiLineTextBuilder.java
index 3ea5fcb..559c138 100644
--- a/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/junit/util/MultiLineTextBuilder.java
+++ b/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/junit/util/MultiLineTextBuilder.java
@@ -16,6 +16,8 @@
 public class MultiLineTextBuilder {
   private final StringBuilder builder = new StringBuilder();
 
+  private int currentLineCount;
+
   public MultiLineTextBuilder() {}
 
   public MultiLineTextBuilder(String initialContent) {
@@ -23,7 +25,10 @@
   }
 
   public MultiLineTextBuilder append(String s) {
-    builder.append(s).append(lineSeparator());
+    if (currentLineCount++ > 0) {
+      builder.append(lineSeparator());
+    }
+    builder.append(s);
     return this;
   }
 
diff --git a/com.google.eclipse.protobuf.ui.functional.test/src/com/google/eclipse/protobuf/ui/editor/Formatter_Test.java b/com.google.eclipse.protobuf.ui.functional.test/src/com/google/eclipse/protobuf/ui/editor/Formatter_Test.java
deleted file mode 100644
index 934e31b..0000000
--- a/com.google.eclipse.protobuf.ui.functional.test/src/com/google/eclipse/protobuf/ui/editor/Formatter_Test.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Copyright (c) 2012 Google Inc.
- *
- * All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse
- * Public License v1.0 which accompanies this distribution, and is available at
- *
- * http://www.eclipse.org/legal/epl-v10.html
- */
-package com.google.eclipse.protobuf.ui.editor;
-
-import static org.hamcrest.core.IsEqual.equalTo;
-import static org.junit.Assert.assertThat;
-
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.swt.SWT;
-import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor;
-import org.junit.*;
-
-import com.google.eclipse.protobuf.formatting.ProtobufFormatter;
-import com.google.eclipse.protobuf.ui.junit.core.CommentReaderRule;
-import com.google.eclipse.protobuf.ui.swtbot.ProtobufBot;
-
-/**
- * Tests for <code>{@link ProtobufFormatter}</code>.
- *
- * @author alruiz@google.com (Alex Ruiz)
- */
-public class Formatter_Test {
-  private static ProtobufBot robot;
-
-  public @Rule CommentReaderRule commentReader = new CommentReaderRule();
-
-  @BeforeClass public static void setUpOnce() throws CoreException {
-    robot = new ProtobufBot();
-    robot.resetAll();
-    robot.createGeneralProject("FormatterTest");
-    SWTBotEclipseEditor editor = robot.createFile("dummy.proto");
-    editor.setText("syntax = 'proto2';");
-    editor.saveAndClose();
-  }
-
-  // syntax = 'proto2';import 'google/protobuf/descriptor.proto';
-
-  // syntax = 'proto2';
-  //
-  // import 'google/protobuf/descriptor.proto';
-  @Test public void should_format_syntax() {
-    SWTBotEclipseEditor editor = robot.createFile("formatSyntax.proto");
-    Comments comments = commentsAbove();
-    editor.setText(comments.beforeFormatting);
-    formatAndSave(editor);
-    assertThat(editor.getText(), equalTo(comments.expected));
-  }
-
-  // package com.google.proto.test;import 'google/protobuf/descriptor.proto';
-
-  // package com.google.proto.test;
-  //
-  // import 'google/protobuf/descriptor.proto';
-  @Test public void should_format_package() {
-    SWTBotEclipseEditor editor = robot.createFile("formatPackage.proto");
-    Comments comments = commentsAbove();
-    editor.setText(comments.beforeFormatting);
-    formatAndSave(editor);
-    assertThat(editor.getText(), equalTo(comments.expected));
-  }
-
-  // import 'dummy.proto';import 'google/protobuf/descriptor.proto';
-
-  // import 'dummy.proto';
-  // import 'google/protobuf/descriptor.proto';
-  @Test public void should_format_normal_import() {
-    SWTBotEclipseEditor editor = robot.createFile("formatNormalImport.proto");
-    Comments comments = commentsAbove();
-    editor.setText(comments.beforeFormatting);
-    formatAndSave(editor);
-    assertThat(editor.getText(), equalTo(comments.expected));
-  }
-
-  // import public 'dummy.proto';import 'google/protobuf/descriptor.proto';
-
-  // import public 'dummy.proto';
-  // import 'google/protobuf/descriptor.proto';
-  @Test public void should_format_public_import() {
-    SWTBotEclipseEditor editor = robot.createFile("formatPublicImport.proto");
-    Comments comments = commentsAbove();
-    editor.setText(comments.beforeFormatting);
-    formatAndSave(editor);
-    assertThat(editor.getText(), equalTo(comments.expected));
-  }
-
-  // import weak 'dummy.proto';import 'google/protobuf/descriptor.proto';
-
-  // import weak 'dummy.proto';
-  // import 'google/protobuf/descriptor.proto';
-  @Test public void should_format_weak_import() {
-    SWTBotEclipseEditor editor = robot.createFile("formatWeakImport.proto");
-    Comments comments = commentsAbove();
-    editor.setText(comments.beforeFormatting);
-    formatAndSave(editor);
-    assertThat(editor.getText(), equalTo(comments.expected));
-  }
-
-  // option java_package = "com.foo.bar";option optimize_for = CODE_SIZE;
-
-  // option java_package = "com.foo.bar";
-  // option optimize_for = CODE_SIZE;
-  @Test public void should_format_native_option() {
-    SWTBotEclipseEditor editor = robot.createFile("formatNativeOption.proto");
-    Comments comments = commentsAbove();
-    editor.setText(comments.beforeFormatting);
-    formatAndSave(editor);
-    assertThat(editor.getText(), equalTo(comments.expected));
-  }
-
-  private Comments commentsAbove() {
-    return new Comments(commentReader.commentsInCurrentTestMethod());
-  }
-
-  private void formatAndSave(SWTBotEclipseEditor editor) {
-    editor.pressShortcut(SWT.MOD1 | SWT.SHIFT, 'F');
-    editor.save();
-  }
-
-  @After public void tearDown() {
-    robot.saveAndCloseAllEditors();
-  }
-
-  private static class Comments {
-    String beforeFormatting;
-    String expected;
-
-    Comments(List<String> comments) {
-      beforeFormatting = comments.get(0);
-      expected = comments.get(1);
-    }
-  }
-}
diff --git a/com.google.eclipse.protobuf.ui.functional.test/src/com/google/eclipse/protobuf/ui/junit/core/CommentReaderRule.java b/com.google.eclipse.protobuf.ui.functional.test/src/com/google/eclipse/protobuf/ui/junit/core/CommentReaderRule.java
deleted file mode 100644
index 6907091..0000000
--- a/com.google.eclipse.protobuf.ui.functional.test/src/com/google/eclipse/protobuf/ui/junit/core/CommentReaderRule.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2012 Google Inc.
- *
- * All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse
- * Public License v1.0 which accompanies this distribution, and is available at
- *
- * http://www.eclipse.org/legal/epl-v10.html
- */
-package com.google.eclipse.protobuf.ui.junit.core;
-
-import java.util.List;
-
-import org.junit.rules.MethodRule;
-import org.junit.runners.model.*;
-
-import com.google.eclipse.protobuf.junit.core.CommentReader;
-
-/**
- * JUnit <code>{@link MethodRule}</code> that keeps a registry of comments per method.
- *
- * @author alruiz@google.com (Alex Ruiz)
- */
-public class CommentReaderRule implements MethodRule {
-  private final CommentReader reader = new CommentReader();
-
-  private List<String> comments;
-
-  @Override public Statement apply(Statement base, FrameworkMethod method, Object target) {
-    comments = reader.commentsIn(method);
-    return base;
-  }
-
-  public List<String> commentsInCurrentTestMethod() {
-    return comments;
-  }
-}
diff --git a/com.google.eclipse.protobuf.ui.functional.test/src/com/google/eclipse/protobuf/ui/swtbot/ProtobufBot.java b/com.google.eclipse.protobuf.ui.functional.test/src/com/google/eclipse/protobuf/ui/swtbot/ProtobufBot.java
index fd32469..a08685b 100644
--- a/com.google.eclipse.protobuf.ui.functional.test/src/com/google/eclipse/protobuf/ui/swtbot/ProtobufBot.java
+++ b/com.google.eclipse.protobuf.ui.functional.test/src/com/google/eclipse/protobuf/ui/swtbot/ProtobufBot.java
@@ -10,8 +10,6 @@
 
 import static com.google.eclipse.protobuf.ui.util.Workspaces.workspaceRoot;
 
-import java.util.List;
-
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.runtime.*;
 import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
@@ -63,8 +61,7 @@
   }
 
   public void saveAndCloseAllEditors() {
-    List<? extends SWTBotEditor> editors = editors();
-    for (SWTBotEditor editor : editors) {
+    for (SWTBotEditor editor : editors()) {
       editor.saveAndClose();
     }
   }
diff --git a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/resource/IndexLookup.java b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/resource/IndexLookup.java
index f72c2be..9e3dfb3 100644
--- a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/resource/IndexLookup.java
+++ b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/resource/IndexLookup.java
@@ -40,7 +40,7 @@
   }
 
   private IResourceDescription lookup(IPath path) {
-    URI uri = URI.createPlatformResourceURI(path.toOSString(), true);
+    URI uri = URI.createPlatformResourceURI(path.toPortableString(), true);
     return xtextIndex.getResourceDescription(uri);
   }