Modernize o.e.dltk.ruby.ui.tests.

* Enable more warnings and fix them.
* Enable save actions to automate work.

Change-Id: Ia497936d4892c350892efc06160062d598681328
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
diff --git a/tests/org.eclipse.dltk.ruby.ui.tests/.settings/org.eclipse.jdt.core.prefs b/tests/org.eclipse.dltk.ruby.ui.tests/.settings/org.eclipse.jdt.core.prefs
index 51a642f..b3acfe0 100644
--- a/tests/org.eclipse.dltk.ruby.ui.tests/.settings/org.eclipse.jdt.core.prefs
+++ b/tests/org.eclipse.dltk.ruby.ui.tests/.settings/org.eclipse.jdt.core.prefs
@@ -1,8 +1,106 @@
 eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
+org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
+org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
+org.eclipse.jdt.core.compiler.annotation.nonnull.secondary=
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary=
+org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
+org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
+org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
 org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
 org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
 org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
+org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning
+org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
+org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
+org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=disabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=disabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
 org.eclipse.jdt.core.compiler.source=1.8
diff --git a/tests/org.eclipse.dltk.ruby.ui.tests/.settings/org.eclipse.jdt.ui.prefs b/tests/org.eclipse.dltk.ruby.ui.tests/.settings/org.eclipse.jdt.ui.prefs
index 43df84b..fbac55c 100644
--- a/tests/org.eclipse.dltk.ruby.ui.tests/.settings/org.eclipse.jdt.ui.prefs
+++ b/tests/org.eclipse.dltk.ruby.ui.tests/.settings/org.eclipse.jdt.ui.prefs
@@ -13,11 +13,11 @@
 sp_cleanup.always_use_parentheses_in_expressions=false
 sp_cleanup.always_use_this_for_non_static_field_access=false
 sp_cleanup.always_use_this_for_non_static_method_access=false
-sp_cleanup.convert_functional_interfaces=false
+sp_cleanup.convert_functional_interfaces=true
 sp_cleanup.convert_to_enhanced_for_loop=false
 sp_cleanup.correct_indentation=false
 sp_cleanup.format_source_code=true
-sp_cleanup.format_source_code_changes_only=true
+sp_cleanup.format_source_code_changes_only=false
 sp_cleanup.insert_inferred_type_arguments=false
 sp_cleanup.make_local_variable_final=true
 sp_cleanup.make_parameters_final=false
diff --git a/tests/org.eclipse.dltk.ruby.ui.tests/src/org/eclipse/dltk/ruby/ui/tests/folding/RubyFoldingTest.java b/tests/org.eclipse.dltk.ruby.ui.tests/src/org/eclipse/dltk/ruby/ui/tests/folding/RubyFoldingTest.java
index 398b808..a944be5 100755
--- a/tests/org.eclipse.dltk.ruby.ui.tests/src/org/eclipse/dltk/ruby/ui/tests/folding/RubyFoldingTest.java
+++ b/tests/org.eclipse.dltk.ruby.ui.tests/src/org/eclipse/dltk/ruby/ui/tests/folding/RubyFoldingTest.java
@@ -29,8 +29,7 @@
 
 public class RubyFoldingTest {
 
-	private class MyRubyASTFoldingStructureProvider extends
-			RubyFoldingStructureProvider {
+	private class MyRubyASTFoldingStructureProvider extends RubyFoldingStructureProvider {
 		public boolean codeFolding = true;
 		public boolean commentFolding = true;
 
@@ -42,16 +41,14 @@
 		}
 
 		@Override
-		protected FoldingStructureComputationContext createContext(
-				boolean allowCollapse) {
+		protected FoldingStructureComputationContext createContext(boolean allowCollapse) {
 			ProjectionAnnotationModel model = new ProjectionAnnotationModel();
 
 			IDocument doc = getDocument();
 			if (doc == null)
 				return null;
 
-			return new FoldingStructureComputationContext(doc, model,
-					allowCollapse);
+			return new FoldingStructureComputationContext(doc, model, allowCollapse);
 		}
 
 		Document fDocument;
@@ -71,33 +68,31 @@
 		}
 
 		@Override
-		protected boolean mayCollapse(ASTNode s,
-				FoldingStructureComputationContext ctx) {
+		protected boolean mayCollapse(ASTNode s, FoldingStructureComputationContext ctx) {
 			return codeFolding && super.mayCollapse(s, ctx);
 		}
 
-	};
+	}
 
 	IPreferenceStore fStore;
 	MyRubyASTFoldingStructureProvider provider;
 
 	@Before
-	public void setUp() throws Exception {
+	public void setUp() {
 		fStore = RubyUITestsPlugin.getDefault().getPreferenceStore();
 		RubyPreferenceConstants.initializeDefaultValues(fStore);
 		provider = new MyRubyASTFoldingStructureProvider();
 	}
 
 	@Test
-	public void test0() throws Exception {
+	public void test0() {
 		fStore.setValue(PreferenceConstants.EDITOR_FOLDING_LINES_LIMIT, 2);
 		String content = "#ab\n#dc\n";
 		Document document = new Document(content);
 		TestUtils.installStuff(document);
 		provider.setDocument(document);
 		Map<Annotation, Position> result = provider.testComputeFoldingStructure(content,
-				provider
-				.createInitialContext());
+				provider.createInitialContext());
 		assertEquals(1, result.size());
 	}
 
@@ -109,8 +104,7 @@
 		TestUtils.installStuff(document);
 		provider.setDocument(document);
 		Map<Annotation, Position> result = provider.testComputeFoldingStructure(content,
-				provider
-				.createInitialContext());
+				provider.createInitialContext());
 		assertEquals(3 + 3, result.size());
 	}
 
@@ -122,8 +116,7 @@
 		TestUtils.installStuff(document);
 		provider.setDocument(document);
 		Map<Annotation, Position> result = provider.testComputeFoldingStructure(content,
-				provider
-				.createInitialContext());
+				provider.createInitialContext());
 		assertEquals(2 + 3, result.size());
 	}
 
@@ -136,8 +129,7 @@
 		provider.codeFolding = false;
 		provider.setDocument(document);
 		Map<Annotation, Position> result = provider.testComputeFoldingStructure(content,
-				provider
-				.createInitialContext());
+				provider.createInitialContext());
 		assertEquals(27, result.size());
 	}
 
@@ -150,8 +142,7 @@
 		provider.commentFolding = false;
 		provider.setDocument(document);
 		Map<Annotation, Position> result = provider.testComputeFoldingStructure(content,
-				provider
-				.createInitialContext());
+				provider.createInitialContext());
 		assertEquals(73 + 13 + 1, result.size());
 	}
 
@@ -163,8 +154,7 @@
 		TestUtils.installStuff(document);
 		provider.setDocument(document);
 		Map<Annotation, Position> result = provider.testComputeFoldingStructure(content,
-				provider
-				.createInitialContext());
+				provider.createInitialContext());
 		assertEquals(100 + 13 + 1, result.size());
 	}
 }
diff --git a/tests/org.eclipse.dltk.ruby.ui.tests/src/org/eclipse/dltk/ruby/ui/tests/indenting/RubyAutoIndentStrategyTest.java b/tests/org.eclipse.dltk.ruby.ui.tests/src/org/eclipse/dltk/ruby/ui/tests/indenting/RubyAutoIndentStrategyTest.java
index c80fe48..54e5689 100644
--- a/tests/org.eclipse.dltk.ruby.ui.tests/src/org/eclipse/dltk/ruby/ui/tests/indenting/RubyAutoIndentStrategyTest.java
+++ b/tests/org.eclipse.dltk.ruby.ui.tests/src/org/eclipse/dltk/ruby/ui/tests/indenting/RubyAutoIndentStrategyTest.java
@@ -23,11 +23,10 @@
 import org.junit.Before;
 import org.junit.Test;
 
-
 public class RubyAutoIndentStrategyTest {
 	/*
-	 * Tests with _ in the beginning relies on features, not
-	 * presented now, and may be will be implemented in future
+	 * Tests with _ in the beginning relies on features, not presented now, and
+	 * may be will be implemented in future
 	 */
 
 	private static final String TAB = "\t";
@@ -39,1134 +38,1081 @@
 	private static String DELIMITER = TextUtilities.getDefaultLineDelimiter(new Document());
 	private static String BLOCK_END = DELIMITER + "end";
 
-
-    private RubyAutoEditStrategy strategy;
+	private RubyAutoEditStrategy strategy;
 	private String doc;
 	private DocCmd docCmd;
 	private String expected;
 	IPreferenceStore fStore;
 
-
 	@Before
-	public void setUp() throws Exception {
-    	fStore = new PreferenceStore();
-    	RubyPreferenceConstants.initializeDefaultValues(fStore);
-    	fStore.setValue(CodeFormatterConstants.FORMATTER_TAB_CHAR, CodeFormatterConstants.TAB);
-    	fStore.setValue(PreferenceConstants.EDITOR_CLOSE_BRACES, true);
-    	fStore.setValue(PreferenceConstants.EDITOR_SMART_PASTE, true);
-    	fStore.setValue(PreferenceConstants.EDITOR_SMART_INDENT, true);
+	public void setUp() {
+		fStore = new PreferenceStore();
+		RubyPreferenceConstants.initializeDefaultValues(fStore);
+		fStore.setValue(CodeFormatterConstants.FORMATTER_TAB_CHAR, CodeFormatterConstants.TAB);
+		fStore.setValue(PreferenceConstants.EDITOR_CLOSE_BRACES, true);
+		fStore.setValue(PreferenceConstants.EDITOR_SMART_PASTE, true);
+		fStore.setValue(PreferenceConstants.EDITOR_SMART_INDENT, true);
 		String fPartitioning = IRubyPartitions.RUBY_PARTITIONING;
-    	strategy = new RubyAutoEditStrategy(fPartitioning, fStore);
-    }
+		strategy = new RubyAutoEditStrategy(fPartitioning, fStore);
+	}
 
-    public void __testTab() { System.out.println("Tab\n");
+	public void __testTab() {
+		System.out.println("Tab\n");
 
-        String str =
-            "        args = [ '-1', '-2',\n"+
-            "                ";
-        DocCmd docCmd = new DocCmd(str.length(), 0, "\t");
-        strategy.customizeDocumentCommand(new Document(str), docCmd);
-        assertEquals("    ", docCmd.text);
-    }
+		String str = "        args = [ '-1', '-2',\n" + "                ";
+		DocCmd docCmd = new DocCmd(str.length(), 0, "\t");
+		strategy.customizeDocumentCommand(new Document(str), docCmd);
+		assertEquals("    ", docCmd.text);
+	}
 
-    public void _testSpaces() { System.out.println("Spaces\n");
+	public void _testSpaces() {
+		System.out.println("Spaces\n");
 
-        DocCmd docCmd = new DocCmd(0, 0, "\t");
-        strategy.customizeDocumentCommand(new Document(""), docCmd);
-        assertEquals("    ", docCmd.text);
+		DocCmd docCmd = new DocCmd(0, 0, "\t");
+		strategy.customizeDocumentCommand(new Document(""), docCmd);
+		assertEquals("    ", docCmd.text);
 
-        docCmd = new DocCmd(0, 0, "\t\t");
-        strategy.customizeDocumentCommand(new Document(""), docCmd);
-        assertEquals("        ", docCmd.text);
+		docCmd = new DocCmd(0, 0, "\t\t");
+		strategy.customizeDocumentCommand(new Document(""), docCmd);
+		assertEquals("        ", docCmd.text);
 
-        docCmd = new DocCmd(0, 0, "\tabc");
-        strategy.customizeDocumentCommand(new Document(""), docCmd);
-        assertEquals("    abc", docCmd.text);
+		docCmd = new DocCmd(0, 0, "\tabc");
+		strategy.customizeDocumentCommand(new Document(""), docCmd);
+		assertEquals("    abc", docCmd.text);
 
-        docCmd = new DocCmd(0, 0, "\tabc\t");
-        strategy.customizeDocumentCommand(new Document(""), docCmd);
-        assertEquals("    abc    ", docCmd.text);
+		docCmd = new DocCmd(0, 0, "\tabc\t");
+		strategy.customizeDocumentCommand(new Document(""), docCmd);
+		assertEquals("    abc    ", docCmd.text);
 
-        docCmd = new DocCmd(0, 0, " ");
-        strategy.customizeDocumentCommand(new Document(""), docCmd);
-        assertEquals(" ", docCmd.text);
-    }
+		docCmd = new DocCmd(0, 0, " ");
+		strategy.customizeDocumentCommand(new Document(""), docCmd);
+		assertEquals(" ", docCmd.text);
+	}
 
-    public void doTestInsertion(String prefix, String postfix, String inserted, String expected) {
-	    Document doc = new Document(prefix + postfix);
-	    DocCmd docCmd = new DocCmd(prefix.length(), 0, inserted);
-	    strategy.customizeDocumentCommand(doc, docCmd);
-	    assertEquals(expected, docCmd.text);
-    }
-
-    public void doTestLineReindent(String prefix, String line, String appended, String postfix, String expected) throws Exception {
-    	Document doc = new Document(prefix + line + postfix);
-    	DocCmd cmd = new DocCmd(prefix.length() + line.length(), 0, appended);
-    	strategy.customizeDocumentCommand(doc, cmd);
-    	doc.replace(cmd.offset, cmd.length, cmd.text);
-    	assertEquals(expected, doc.get());
-    }
-
-    public void doTestNewLineIndent(String prefix, String postfix, String indent) {
-		doTestInsertion(prefix, postfix, "\n", "\n" + indent);
-    }
-
-	@Test
-    public void testSimpleNewLine() {
-    	String stat1 = "def foo";
-    	String stat2 = "puts 'Ruby is cool'";
-    	doTestNewLineIndent(stat1 + "\n" + TAB + stat2, DUMMY_POSTFIX, TAB);
-    }
-
-	@Test
-    public void testIndentedNewLineAfterDef() {
-    	String stat1 = "def foo";
-    	doTestNewLineIndent(stat1, DUMMY_POSTFIX, AUTOINDENT + DUMMY_POSTFIX + BLOCK_END);
-    }
-
-	@Test
-    public void testIndentedNewLineAfterIf() {
-    	String stat1 = "if a==0";
-    	doTestNewLineIndent(stat1, DUMMY_POSTFIX, AUTOINDENT + DUMMY_POSTFIX + BLOCK_END);
-    	String stat2 = "def foo" + DELIMITER + "end" + DELIMITER + "if a==0";
-    	doTestNewLineIndent(stat2, DUMMY_POSTFIX, AUTOINDENT + DUMMY_POSTFIX + BLOCK_END);
-    }
-
-    private void doTestBraceDeindent(String opening, String closing) throws Exception {
-    	String s1 = "\tputs " + opening + "\n";
-    	String s2 = "\t        2+2\n";
-    	doTestLineReindent(s1 + s2, "\t        ", closing, "",
-    			s1 + s2 + "\t        " + closing);
-    }
-
-	@Test
-    public void testIndentingOfClosingParenToOpeningOne() throws Exception {
-    	doTestBraceDeindent("(", ")");
-    }
-
-	@Test
-    public void testIndentingOfClosingSquareBraceToOpeningOne() throws Exception {
-    	doTestBraceDeindent("[", "]");
-    }
-
-	@Test
-    public void testIndentingOfClosingCurlyBrace() throws Exception {
-    	String s1 = "\t puts {\n";
-    	String s2 = "\t\t\t     2+2\n";
-    	doTestLineReindent(s1 + s2, "\t        ", "}", "",
-    			s1 + s2 + "\t }");
-    }
-
-	@Test
-    public void testDeindentingOfRdocBegin() throws Exception {
-    	String s1 = "\t puts {\n";
-    	doTestLineReindent(s1, "\t\t\t=begi", "n", "", s1 + "=begin");
-    }
-
-	@Test
-    public void testDeindentingOfRdocEnd() throws Exception {
-    	String s1 = "\t puts {\n";
-    	doTestLineReindent(s1, "\t\t\t=en", "d", "", s1 + "=end");
-    }
-
-	@Test
-    public void testDeindentOnEnd() throws Exception {
-    	String s1 = "\tdef foo\n";
-		String s2 = "\t\tputs\n";
-		doTestLineReindent(s1 + s2, "\t\ten", "d", "",
-				s1 + s2 + "\tend");
-    }
-
-    public void __testNewLineAfterReturn() { System.out.println("NewLineAfterReturn\n");
-
-    	String str = "dfdsfd" +
-    			"def m1(self):\n" +
-    			"    return 'foo'\n" +
-    			"#ffo";
-    	final Document doc = new Document(str);
-    	DocCmd docCmd = new DocCmd(doc.getLength()-"#ffo".length(), 0, "\n");
-    	strategy.customizeDocumentCommand(doc, docCmd);
-    	assertEquals("\n", docCmd.text);
-
-    }
-
-    public void __testIgnoreComment() { System.out.println("IgnoreComment\n");
-
-    	String str = "" +
-    	"titleEnd = ('[#')" +
-    	"";
-    	final Document doc = new Document(str);
-    	DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\n");
-    	strategy.customizeDocumentCommand(doc, docCmd);
-    	assertEquals("\n", docCmd.text);
-
-    }
-
-    public void __testIgnoreComment2() { System.out.println("IgnoreComment2\n");
-
-    	String str = "" +
-    	"titleEnd = ('''\n" +
-    	"            [#''')" + //should wrap to the start
-    	"";
-    	final Document doc = new Document(str);
-    	DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\n");
-    	strategy.customizeDocumentCommand(doc, docCmd);
-    	assertEquals("\n", docCmd.text);
-
-    }
-
-    public void _testNewLineAfterOpeningParWithOtherContents() { System.out.println("NewLineAfterOpeningParWithOtherContents\n");
-
-    	String str = "" +
-    	"def m1(  self,";
-    	//        |<-- should indent here in this case, and not on the parenthesis
-    	final Document doc = new Document(str);
-    	DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\n");
-    	strategy.customizeDocumentCommand(doc, docCmd);
-    	assertEquals("\n         ", docCmd.text);
-    }
-
-    public void _testNewLineAfterReturn2() { System.out.println("NewLineAfterReturn2\n");
-
-        String str = "" +
-        "def m1(self):\n" +
-        "    return ('foo',";
-
-
-        final Document doc = new Document(str);
-        DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\n");
-        strategy.customizeDocumentCommand(doc, docCmd);
-        assertEquals("\n            ", docCmd.text);
-
-    }
-
-
-    public void __testMaintainIndent() { System.out.println("MaintainIndent\n");
-
-        String str = "" +
-        "def moo():\n" +
-        "    if not 1:\n" +
-        "        print 'foo'\n" +
-        "    print 'bla'"+
-        "";
-
-
-        final Document doc = new Document(str);
-        DocCmd docCmd = new DocCmd(doc.getLength()-"print 'bla'".length(), 0, "\n");
-        strategy.customizeDocumentCommand(doc, docCmd);
-        assertEquals("\n    ", docCmd.text);
-
-    }
-
-    public void _testMaintainIndent2() { System.out.println("MaintainIndent2\n");
-
-    	String str = "" +
-    	"def moo():\n" +
-    	"    if not 1:\n" +
-    	"        print 'foo'\n" +
-    	"    print 'bla'"+
-    	"";
-
-
-    	final Document doc = new Document(str);
-    	int offset = doc.getLength()-"  print 'bla'".length();
-		DocCmd docCmd = new DocCmd(offset, 0, "\n");
-    	strategy.customizeDocumentCommand(doc, docCmd);
-    	assertEquals("\n  ", docCmd.text);
-    	assertEquals(offset+2, docCmd.caretOffset);
-
-    }
-
-
-    public void __testDontChangeCursorOffset() { System.out.println("DontChangeCursorOffset\n");
-
-    	String str = "" +
-    	"def moo():\n" +
-    	"    if not 1:\n" +
-    	"        print    'foo'" +
-    	"";
-
-
-    	final Document doc = new Document(str);
-    	int offset = doc.getLength()-"    'foo'".length();
-    	DocCmd docCmd = new DocCmd(offset, 0, "\n");
-    	strategy.customizeDocumentCommand(doc, docCmd);
-    	assertEquals("\n        ", docCmd.text);
-    	assertEquals(-1, docCmd.caretOffset); //don't change it
-
-    }
-
-
-    public void __testTabIndentToLevel() { System.out.println("TabIndentToLevel\n");
-
-    	String str = "" +
-    	"properties.create( \n" +
-    	"                  a,\n" +
-    	"        \n" +
-    	"\n" + //cursor is here
-    	"                  b,\n" +
-    	")" +
-    	"";
-
-
-    	final Document doc = new Document(str);
-    	int offset = doc.getLength()-"\n                  b,\n)".length();
-    	DocCmd docCmd = new DocCmd(offset, 0, "\t");
-    	strategy.customizeDocumentCommand(doc, docCmd);
-    	assertEquals("                  ", docCmd.text);
-
-    }
-
-
-
-    public void _testTabIndentToLevel2() { System.out.println("TabIndentToLevel2\n");
-
-    	String str = "" +
-    	"class ContaminantFont( Barrier, ModelBase ):\n" +
-    	"    '''\n" +
-    	"    This class contains information to edit a contaminant.\n" +
-    	"    '''\n" +
-    	"    properties.create( \n" +
-    	"                          \n" +
-    	"                          #defines where is the source (in the water or in the soil)\n" +
-    	"                          sourceLocation = SOURCE_LOCATION_WATER,\n" +
-    	"                          \n" +
-    	"" + //we're here (indent to the first level)
-    	"";
-
-
-    	final Document doc = new Document(str);
-    	int offset = doc.getLength();
-    	DocCmd docCmd = new DocCmd(offset, 0, "\t");
-    	strategy.customizeDocumentCommand(doc, docCmd);
-    	assertEquals("    ", docCmd.text);
-
-    }
-
-
-
-    public void __testTabIndentToLevel3() { System.out.println("TabIndentToLevel3\n");
-
-    	String str = "" +
-    	"class ContaminantFont( Barrier, ModelBase ):\n" +
-    	"    '''\n" +
-    	"    This class contains information to edit a contaminant.\n" +
-    	"    '''\n" +
-    	"    properties.create( \n" +
-    	"                          \n" +
-    	"                          #defines where is the source (in the water or in the soil)\n" +
-    	"                          sourceLocation = SOURCE_LOCATION_WATER,\n" +
-    	"                          \n" +
-    	"    " + //now that we're already in the first level, indent to the current level
-    	"";
-
-
-    	final Document doc = new Document(str);
-    	int offset = doc.getLength();
-    	DocCmd docCmd = new DocCmd(offset, 0, "\t");
-    	strategy.customizeDocumentCommand(doc, docCmd);
-    	assertEquals("                          ", docCmd.text);
-    	assertEquals(offset - 4, docCmd.offset);
-    	assertEquals(4, docCmd.length);
-    }
-
-
-    public void __testNoAutoIndentClosingPar() { System.out.println("NoAutoIndentClosingPar\n");
-
-    	String str = "" +
-    	"newTuple = (\n" +
-    	"              what(),\n" + //the next line should be indented to this one, and not to the start of the indent
-    	"            )\n" +
-    	"";
-
-
-    	final Document doc = new Document(str);
-    	String s =
-    		"\n"+
-    		"            )\n";
-    	DocCmd docCmd = new DocCmd(doc.getLength()-s.length(), 0, "\n");
-    	strategy.customizeDocumentCommand(doc, docCmd);
-    	assertEquals("\n              ", docCmd.text);
-
-    }
-
-    public void __testNoAutoIndentClosingPar2() { System.out.println("NoAutoIndentClosingPar2\n");
-
-    	String str = "" +
-    	"newTuple = (\n" +
-    	"              what(),\n" +
-    	"\n" + //pressing tab in the start of this line will bring us to the 'what()' level.
-    	"            )\n" +
-    	"";
-
-
-    	final Document doc = new Document(str);
-    	String s =
-    		"\n"+
-    		"            )\n";
-    	DocCmd docCmd = new DocCmd(doc.getLength()-s.length(), 0, "\t");
-    	strategy.customizeDocumentCommand(doc, docCmd);
-    	assertEquals("              ", docCmd.text);
-
-    }
-
-    public void __testNewLineAfterLineWithComment() { System.out.println("NewLineAfterLineWithComment\n");
-
-    	String str = "" +
-    	"string1 = '01234546789[#]'" +
-    	"";
-    	final Document doc = new Document(str);
-    	DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\n");
-    	strategy.customizeDocumentCommand(doc, docCmd);
-    	assertEquals("\n", docCmd.text);
-
-    }
-
-    public void __testNewLine10() { System.out.println("NewLine10\n");
-
-    	String str = "" +
-    	"def M1(a):\n" +
-    	"    doFoo(a,b(),\n" +
-    	"          '',b)" +
-    	"";
-    	final Document doc = new Document(str);
-    	DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\n");
-    	strategy.customizeDocumentCommand(doc, docCmd);
-    	assertEquals("\n    ", docCmd.text);
-
-    }
-
-    public void __testNewLine11() { System.out.println("NewLine11\n");
-
-    	String str = "" +
-    	"def fun():\n" +
-    	"    if True:\n" +
-    	"        passif False: 'foo'" +
-    	"";
-    	final Document doc = new Document(str);
-    	DocCmd docCmd = new DocCmd(doc.getLength()-"if False: 'foo'".length(), 0, "\n");
-    	strategy.customizeDocumentCommand(doc, docCmd);
-    	assertEquals("\n    ", docCmd.text);
-
-    }
-
-
-    public void __testNewLine12() { System.out.println("NewLine12\n");
-
-    	String str = "" +
-    	"if False:print 'done'" +
-    	"";
-    	final Document doc = new Document(str);
-    	DocCmd docCmd = new DocCmd(doc.getLength()-"print 'done'".length(), 0, "\n");
-    	strategy.customizeDocumentCommand(doc, docCmd);
-    	assertEquals("\n    ", docCmd.text);
-    }
-
-
-    public void __testNewLine3() { System.out.println("NewLine3\n");
-
-    	String str = "for a in b:    " +
-    	"";
-    	final Document doc = new Document(str);
-    	DocCmd docCmd = new DocCmd(doc.getLength()-4, 0, "\n");
-    	strategy.customizeDocumentCommand(doc, docCmd);
-    	assertEquals("\n    ", docCmd.text);
-
-    	String expected = "for a in b:    ";
-    	assertEquals(expected, doc.get());
-    }
-
-    public void __testNewLine6() { System.out.println("NewLine6\n");
-
-    	String str = "" +
-    			"for v in w:\n" +
-    			"    pass\n" + //dedent on pass
-    			"";
-    	final Document doc = new Document(str);
-    	DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\n");
-    	strategy.customizeDocumentCommand(doc, docCmd);
-    	assertEquals("\n", docCmd.text);
-    }
-
-    public void __testNewLine6a() { System.out.println("NewLine6a\n");
-
-    	String str = "" +
-    	"def getSpilledComps( *dummy ):\n" +
-    	"    return [self.component4]" + //dedent here
-    	"";
-    	final Document doc = new Document(str);
-    	DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\n");
-    	strategy.customizeDocumentCommand(doc, docCmd);
-    	assertEquals("\n", docCmd.text);
-    }
-
-    public void __testNewLine7() { System.out.println("NewLine7\n");
-
-        String str = "" +
-        "class C:\n" +
-        "    a = 30\n" +
-        "print C.a\n" +
-        "\n" +
-        "";
-        final Document doc = new Document(str);
-        DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\n");
-        strategy.customizeDocumentCommand(doc, docCmd);
-        assertEquals("\n", docCmd.text);
-    }
-
-    public void __testNewLine8() { System.out.println("NewLine8\n");
-
-        String str = "" +
-        "class C:\n" +
-        "    pass\n" +
-        "    a = 30\n" +
-        "    " +
-        "";
-        final Document doc = new Document(str);
-        DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\n");
-        strategy.customizeDocumentCommand(doc, docCmd);
-        assertEquals("\n    ", docCmd.text);
-    }
-
-    public void __testIndent() { System.out.println("Indent\n");
-
-    	String str = "" +
-    	"while False:\n" +
-    	"    if foo:" +
-    	"";
-    	final Document doc = new Document(str);
-    	DocCmd docCmd = new DocCmd(doc.getLength()-"if foo:".length(), 0, "\n");
-    	strategy.customizeDocumentCommand(doc, docCmd);
-    	assertEquals("\n    ", docCmd.text);
-    }
-
-    public void __testIndentAfterRet() { System.out.println("IndentAfterRet\n");
-
-    	String str = "" +
-    	"class Foo:\n" +
-    	"    def m1():\n" +
-    	"        for a in b:\n" +
-    	"            if a = 20:\n" +
-    	"                print 'foo'\n" +
-    	"        return 30\n" +
-    	"    " +
-    	"";
-    	final Document doc = new Document(str);
-    	DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\n");
-    	strategy.customizeDocumentCommand(doc, docCmd);
-    	assertEquals("\n    ", docCmd.text);
-    }
-
-    public void __testIndentAfterRet2() { System.out.println("IndentAfterRet2\n");
-
-    	String str = "" +
-    	"class Foo:\n" +
-    	"    def m1():\n" +
-    	"        for a in b:\n" +
-    	"            if a = 20:\n" +
-    	"                print 'foo'\n" +
-    	"        return 30\n" +
-    	"    \n" +
-    	"";
-    	final Document doc = new Document(str);
-    	DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\t");
-    	strategy.customizeDocumentCommand(doc, docCmd);
-    	assertEquals("    ", docCmd.text);
-    }
-
-    public void __testNewLine9() { System.out.println("NewLine9\n");
-
-        String str = "" +
-        "class C:\n" +
-        "    try:" +
-        "";
-        final Document doc = new Document(str);
-        DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\n");
-        strategy.customizeDocumentCommand(doc, docCmd);
-        assertEquals("\n        ", docCmd.text);
-    }
-
-    public void __testNewLine4() { System.out.println("NewLine4\n");
-
-    	String str = "" +
-    			"def a():\n" +
-    			"    print a" +
-    	"";
-    	final Document doc = new Document(str);
-    	DocCmd docCmd = new DocCmd(doc.getLength()-"    print a".length(), 0, "\n");
-    	strategy.customizeDocumentCommand(doc, docCmd);
-    	String expected = "" +
-    	"def a():\n" +
-    	"    print a" +
-    	"";
-    	assertEquals(expected, doc.get());
-    	assertEquals("\n", docCmd.text);
-
-    }
-
-    public void _testNewLine5() { System.out.println("NewLine5\n");
-
-    	String str = "" +
-    	"def a():\n" +
-    	"    " +
-    	"";
-    	final Document doc = new Document(str);
-    	DocCmd docCmd = new DocCmd(doc.getLength()-"    ".length(), 0, "\n");
-    	strategy.customizeDocumentCommand(doc, docCmd);
-    	String expected = "" +
-    	"def a():\n" +
-    	"    " +
-    	"";
-    	assertEquals(expected, doc.get());
-    	assertEquals("\n", docCmd.text);
-    }
-
-    public void __testNewLine() { System.out.println("NewLine\n");
-
-    	String str = "createintervention() #create " +
-    	"";
-    	final Document doc = new Document(str);
-    	DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\n");
-    	strategy.customizeDocumentCommand(doc, docCmd);
-    	assertEquals("\n", docCmd.text);
-
-    }
-
-    public void __testNewLine2() { System.out.println("NewLine2\n");
-
-    	String str = "err)" +
-    	"";
-    	final Document doc = new Document(str);
-    	DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\n");
-    	strategy.customizeDocumentCommand(doc, docCmd);
-    	assertEquals("\n", docCmd.text);
-
-    }
-
-
-    public void __testTabInComment() { System.out.println("TabInComment\n");
-
-    	String str = "#comment" +
-    	"";
-    	final Document doc = new Document(str);
-    	DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\t");
-    	strategy.customizeDocumentCommand(doc, docCmd);
-    	assertEquals("    ", docCmd.text); // a single tab should go to the correct indent
-
-    }
-
-    public void __testIndentingWithTab() { System.out.println("IndentingWithTab\n");
-
-    	String str = "class C:\n" +
-    			     "    def m1(self):\n" +
-    			     "";
-    	final Document doc = new Document(str);
-    	DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\t");
+	public void doTestInsertion(String prefix, String postfix, String inserted, String expected) {
+		Document doc = new Document(prefix + postfix);
+		DocCmd docCmd = new DocCmd(prefix.length(), 0, inserted);
 		strategy.customizeDocumentCommand(doc, docCmd);
-    	assertEquals("        ", docCmd.text); // a single tab should go to the correct indent
-    }
+		assertEquals(expected, docCmd.text);
+	}
 
-    public void __testIndentingWithTab2() { System.out.println("IndentingWithTab2\n");
+	public void doTestLineReindent(String prefix, String line, String appended, String postfix, String expected)
+			throws Exception {
+		Document doc = new Document(prefix + line + postfix);
+		DocCmd cmd = new DocCmd(prefix.length() + line.length(), 0, appended);
+		strategy.customizeDocumentCommand(doc, cmd);
+		doc.replace(cmd.offset, cmd.length, cmd.text);
+		assertEquals(expected, doc.get());
+	}
 
-    	String str = "" +
-    			"class C:\n" +
-    			"    pass\n" +
-    			"";
-    	final Document doc = new Document(str);
-    	DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\t");
-    	strategy.customizeDocumentCommand(doc, docCmd);
-    	assertEquals("    ", docCmd.text); // a single tab should go to the correct indent
-    }
+	public void doTestNewLineIndent(String prefix, String postfix, String indent) {
+		doTestInsertion(prefix, postfix, "\n", "\n" + indent);
+	}
 
-    public void __testIndentingWithTab3() { System.out.println("IndentingWithTab3\n");
+	@Test
+	public void testSimpleNewLine() {
+		String stat1 = "def foo";
+		String stat2 = "puts 'Ruby is cool'";
+		doTestNewLineIndent(stat1 + "\n" + TAB + stat2, DUMMY_POSTFIX, TAB);
+	}
 
-    	String str = "" +
-    	"class C:\n" +
-    	"    def m1(self):            \n" +
-    	"        print 1\n" +
-    	"";
-    	final Document doc = new Document(str);
-    	DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\t");
-    	strategy.customizeDocumentCommand(doc, docCmd);
-    	assertEquals("        ", docCmd.text); // a single tab should go to the correct indent
-    }
+	@Test
+	public void testIndentedNewLineAfterDef() {
+		String stat1 = "def foo";
+		doTestNewLineIndent(stat1, DUMMY_POSTFIX, AUTOINDENT + DUMMY_POSTFIX + BLOCK_END);
+	}
 
-//    public void __testWithoutSmartIndent() { System.out.println("WithoutSmartIndent\n");
-//    	final TestIndentPrefs prefs = new TestIndentPrefs(true, 4);
-//    	prefs.smartIndentAfterPar = false;
-//
-//    	String str = "" +
-//    	"class C:\n" +
-//    	"    def m1(self):" +
-//    	"";
-//    	final Document doc = new Document(str);
-//    	DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\n");
-//    	strategy.customizeDocumentCommand(doc, docCmd);
-//    	assertEquals("\n        ", docCmd.text); // a single tab should go to the correct indent
-//    }
+	@Test
+	public void testIndentedNewLineAfterIf() {
+		String stat1 = "if a==0";
+		doTestNewLineIndent(stat1, DUMMY_POSTFIX, AUTOINDENT + DUMMY_POSTFIX + BLOCK_END);
+		String stat2 = "def foo" + DELIMITER + "end" + DELIMITER + "if a==0";
+		doTestNewLineIndent(stat2, DUMMY_POSTFIX, AUTOINDENT + DUMMY_POSTFIX + BLOCK_END);
+	}
 
-    public void __testIndentingWithTab4() { System.out.println("IndentingWithTab4\n");
+	private void doTestBraceDeindent(String opening, String closing) throws Exception {
+		String s1 = "\tputs " + opening + "\n";
+		String s2 = "\t        2+2\n";
+		doTestLineReindent(s1 + s2, "\t        ", closing, "", s1 + s2 + "\t        " + closing);
+	}
 
-    	String str = "" +
-    	"class C:\n" +
-    	"    def m1(self):            \n" +
-    	"        print 'a'\n" +
-    	"        " + //now, a 'regular' tab should happen
-    	"";
-    	final Document doc = new Document(str);
-    	DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\t");
-    	strategy.customizeDocumentCommand(doc, docCmd);
-    	assertEquals("    ", docCmd.text); // a single tab should go to the correct indent
-    }
+	@Test
+	public void testIndentingOfClosingParenToOpeningOne() throws Exception {
+		doTestBraceDeindent("(", ")");
+	}
 
-    public void __testIndentingWithTab5() { System.out.println("IndentingWithTab5\n");
+	@Test
+	public void testIndentingOfClosingSquareBraceToOpeningOne() throws Exception {
+		doTestBraceDeindent("[", "]");
+	}
 
-    	String str = "" +
-    	"class C:\n" +
-    	"    def m1(self):            \n" +
-    	"        print 'a'\n" +
-    	"       " + //now, only 1 space is missing to the correct indent
-    	"";
-    	final Document doc = new Document(str);
-    	DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\t");
-    	strategy.customizeDocumentCommand(doc, docCmd);
-    	//assertEquals(" ", docCmd.text); // a single tab should go to the correct indent
-    	assertEquals ("        ", docCmd.text);
-    	assertEquals ("       ".length(), docCmd.length);
-    	assertEquals (doc.getLength() - "       ".length(), docCmd.offset);
-    }
+	@Test
+	public void testIndentingOfClosingCurlyBrace() throws Exception {
+		String s1 = "\t puts {\n";
+		String s2 = "\t\t\t     2+2\n";
+		doTestLineReindent(s1 + s2, "\t        ", "}", "", s1 + s2 + "\t }");
+	}
 
-    public void __testIndentingWithTab6() { System.out.println("IndentingWithTab6\n");
+	@Test
+	public void testDeindentingOfRdocBegin() throws Exception {
+		String s1 = "\t puts {\n";
+		doTestLineReindent(s1, "\t\t\t=begi", "n", "", s1 + "=begin");
+	}
 
-    	String str = "" +
-    	"class C:\n" +
-    	"    def m1(self):            \n" +
-    	"print 'a'" +
-    	"";
-    	final Document doc = new Document(str);
-    	DocCmd docCmd = new DocCmd(doc.getLength()-"print 'a'".length(), 0, "\t");
-    	strategy.customizeDocumentCommand(doc, docCmd);
-    	assertEquals("        ", docCmd.text); // a single tab should go to the correct indent
-    }
+	@Test
+	public void testDeindentingOfRdocEnd() throws Exception {
+		String s1 = "\t puts {\n";
+		doTestLineReindent(s1, "\t\t\t=en", "d", "", s1 + "=end");
+	}
 
-    public void __testIndentingWithTab7() { System.out.println("IndentingWithTab7\n");
+	@Test
+	public void testDeindentOnEnd() throws Exception {
+		String s1 = "\tdef foo\n";
+		String s2 = "\t\tputs\n";
+		doTestLineReindent(s1 + s2, "\t\ten", "d", "", s1 + s2 + "\tend");
+	}
 
-    	String str = "" +
-    	"class C:\n" +
-    	"    def m1(self):            \n" +
-    	"  print 'a'" +
-    	"";
-    	final Document doc = new Document(str);
-    	DocCmd docCmd = new DocCmd(doc.getLength()-"  print 'a'".length(), 0, "\t");
-    	strategy.customizeDocumentCommand(doc, docCmd);
-    	assertEquals("        ", docCmd.text); // a single tab should go to the correct indent
-    	assertEquals(2, docCmd.length); // the spaces after the indent should be removed
-    }
+	public void __testNewLineAfterReturn() {
+		System.out.println("NewLineAfterReturn\n");
 
-    public void _testTabs() { System.out.println("Tabs\n");
+		String str = "dfdsfd" + "def m1(self):\n" + "    return 'foo'\n" + "#ffo";
+		final Document doc = new Document(str);
+		DocCmd docCmd = new DocCmd(doc.getLength() - "#ffo".length(), 0, "\n");
+		strategy.customizeDocumentCommand(doc, docCmd);
+		assertEquals("\n", docCmd.text);
 
-        DocCmd docCmd = new DocCmd(0, 0, "\t");
-        strategy.customizeDocumentCommand(new Document(""), docCmd);
-        assertEquals("\t", docCmd.text);
+	}
 
-        docCmd = new DocCmd(0, 0, "\t\t");
-        strategy.customizeDocumentCommand(new Document(""), docCmd);
-        assertEquals("\t\t", docCmd.text);
+	public void __testIgnoreComment() {
+		System.out.println("IgnoreComment\n");
 
-        docCmd = new DocCmd(0, 0, "\tabc");
-        strategy.customizeDocumentCommand(new Document(""), docCmd);
-        assertEquals("\tabc", docCmd.text);
+		String str = "" + "titleEnd = ('[#')" + "";
+		final Document doc = new Document(str);
+		DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\n");
+		strategy.customizeDocumentCommand(doc, docCmd);
+		assertEquals("\n", docCmd.text);
 
-        docCmd = new DocCmd(0, 0, "\tabc\t");
-        strategy.customizeDocumentCommand(new Document(""), docCmd);
-        assertEquals("\tabc\t", docCmd.text);
+	}
+
+	public void __testIgnoreComment2() {
+		System.out.println("IgnoreComment2\n");
+
+		String str = "" + "titleEnd = ('''\n" + "            [#''')" + // should
+																		// wrap
+																		// to
+																		// the
+																		// start
+				"";
+		final Document doc = new Document(str);
+		DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\n");
+		strategy.customizeDocumentCommand(doc, docCmd);
+		assertEquals("\n", docCmd.text);
+
+	}
+
+	public void _testNewLineAfterOpeningParWithOtherContents() {
+		System.out.println("NewLineAfterOpeningParWithOtherContents\n");
+
+		String str = "" + "def m1(  self,";
+		// |<-- should indent here in this case, and not on the parenthesis
+		final Document doc = new Document(str);
+		DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\n");
+		strategy.customizeDocumentCommand(doc, docCmd);
+		assertEquals("\n         ", docCmd.text);
+	}
+
+	public void _testNewLineAfterReturn2() {
+		System.out.println("NewLineAfterReturn2\n");
+
+		String str = "" + "def m1(self):\n" + "    return ('foo',";
+
+		final Document doc = new Document(str);
+		DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\n");
+		strategy.customizeDocumentCommand(doc, docCmd);
+		assertEquals("\n            ", docCmd.text);
+
+	}
+
+	public void __testMaintainIndent() {
+		System.out.println("MaintainIndent\n");
+
+		String str = "" + "def moo():\n" + "    if not 1:\n" + "        print 'foo'\n" + "    print 'bla'" + "";
+
+		final Document doc = new Document(str);
+		DocCmd docCmd = new DocCmd(doc.getLength() - "print 'bla'".length(), 0, "\n");
+		strategy.customizeDocumentCommand(doc, docCmd);
+		assertEquals("\n    ", docCmd.text);
+
+	}
+
+	public void _testMaintainIndent2() {
+		System.out.println("MaintainIndent2\n");
+
+		String str = "" + "def moo():\n" + "    if not 1:\n" + "        print 'foo'\n" + "    print 'bla'" + "";
+
+		final Document doc = new Document(str);
+		int offset = doc.getLength() - "  print 'bla'".length();
+		DocCmd docCmd = new DocCmd(offset, 0, "\n");
+		strategy.customizeDocumentCommand(doc, docCmd);
+		assertEquals("\n  ", docCmd.text);
+		assertEquals(offset + 2, docCmd.caretOffset);
+
+	}
+
+	public void __testDontChangeCursorOffset() {
+		System.out.println("DontChangeCursorOffset\n");
+
+		String str = "" + "def moo():\n" + "    if not 1:\n" + "        print    'foo'" + "";
+
+		final Document doc = new Document(str);
+		int offset = doc.getLength() - "    'foo'".length();
+		DocCmd docCmd = new DocCmd(offset, 0, "\n");
+		strategy.customizeDocumentCommand(doc, docCmd);
+		assertEquals("\n        ", docCmd.text);
+		assertEquals(-1, docCmd.caretOffset); // don't change it
+
+	}
+
+	public void __testTabIndentToLevel() {
+		System.out.println("TabIndentToLevel\n");
+
+		String str = "" + "properties.create( \n" + "                  a,\n" + "        \n" + "\n" + // cursor
+																										// is
+																										// here
+				"                  b,\n" + ")" + "";
+
+		final Document doc = new Document(str);
+		int offset = doc.getLength() - "\n                  b,\n)".length();
+		DocCmd docCmd = new DocCmd(offset, 0, "\t");
+		strategy.customizeDocumentCommand(doc, docCmd);
+		assertEquals("                  ", docCmd.text);
+
+	}
+
+	public void _testTabIndentToLevel2() {
+		System.out.println("TabIndentToLevel2\n");
+
+		String str = "" + "class ContaminantFont( Barrier, ModelBase ):\n" + "    '''\n"
+				+ "    This class contains information to edit a contaminant.\n" + "    '''\n"
+				+ "    properties.create( \n" + "                          \n"
+				+ "                          #defines where is the source (in the water or in the soil)\n"
+				+ "                          sourceLocation = SOURCE_LOCATION_WATER,\n" + "                          \n"
+				+ "" + // we're here (indent to the first level)
+				"";
+
+		final Document doc = new Document(str);
+		int offset = doc.getLength();
+		DocCmd docCmd = new DocCmd(offset, 0, "\t");
+		strategy.customizeDocumentCommand(doc, docCmd);
+		assertEquals("    ", docCmd.text);
+
+	}
+
+	public void __testTabIndentToLevel3() {
+		System.out.println("TabIndentToLevel3\n");
+
+		String str = "" + "class ContaminantFont( Barrier, ModelBase ):\n" + "    '''\n"
+				+ "    This class contains information to edit a contaminant.\n" + "    '''\n"
+				+ "    properties.create( \n" + "                          \n"
+				+ "                          #defines where is the source (in the water or in the soil)\n"
+				+ "                          sourceLocation = SOURCE_LOCATION_WATER,\n" + "                          \n"
+				+ "    " + // now that we're already in the first level, indent
+							// to the current level
+				"";
+
+		final Document doc = new Document(str);
+		int offset = doc.getLength();
+		DocCmd docCmd = new DocCmd(offset, 0, "\t");
+		strategy.customizeDocumentCommand(doc, docCmd);
+		assertEquals("                          ", docCmd.text);
+		assertEquals(offset - 4, docCmd.offset);
+		assertEquals(4, docCmd.length);
+	}
+
+	public void __testNoAutoIndentClosingPar() {
+		System.out.println("NoAutoIndentClosingPar\n");
+
+		String str = "" + "newTuple = (\n" + "              what(),\n" + // the
+																			// next
+																			// line
+																			// should
+																			// be
+																			// indented
+																			// to
+																			// this
+																			// one,
+																			// and
+																			// not
+																			// to
+																			// the
+																			// start
+																			// of
+																			// the
+																			// indent
+				"            )\n" + "";
+
+		final Document doc = new Document(str);
+		String s = "\n" + "            )\n";
+		DocCmd docCmd = new DocCmd(doc.getLength() - s.length(), 0, "\n");
+		strategy.customizeDocumentCommand(doc, docCmd);
+		assertEquals("\n              ", docCmd.text);
+
+	}
+
+	public void __testNoAutoIndentClosingPar2() {
+		System.out.println("NoAutoIndentClosingPar2\n");
+
+		String str = "" + "newTuple = (\n" + "              what(),\n" + "\n" + // pressing
+																				// tab
+																				// in
+																				// the
+																				// start
+																				// of
+																				// this
+																				// line
+																				// will
+																				// bring
+																				// us
+																				// to
+																				// the
+																				// 'what()'
+																				// level.
+				"            )\n" + "";
+
+		final Document doc = new Document(str);
+		String s = "\n" + "            )\n";
+		DocCmd docCmd = new DocCmd(doc.getLength() - s.length(), 0, "\t");
+		strategy.customizeDocumentCommand(doc, docCmd);
+		assertEquals("              ", docCmd.text);
+
+	}
+
+	public void __testNewLineAfterLineWithComment() {
+		System.out.println("NewLineAfterLineWithComment\n");
+
+		String str = "" + "string1 = '01234546789[#]'" + "";
+		final Document doc = new Document(str);
+		DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\n");
+		strategy.customizeDocumentCommand(doc, docCmd);
+		assertEquals("\n", docCmd.text);
+
+	}
+
+	public void __testNewLine10() {
+		System.out.println("NewLine10\n");
+
+		String str = "" + "def M1(a):\n" + "    doFoo(a,b(),\n" + "          '',b)" + "";
+		final Document doc = new Document(str);
+		DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\n");
+		strategy.customizeDocumentCommand(doc, docCmd);
+		assertEquals("\n    ", docCmd.text);
+
+	}
+
+	public void __testNewLine11() {
+		System.out.println("NewLine11\n");
+
+		String str = "" + "def fun():\n" + "    if True:\n" + "        passif False: 'foo'" + "";
+		final Document doc = new Document(str);
+		DocCmd docCmd = new DocCmd(doc.getLength() - "if False: 'foo'".length(), 0, "\n");
+		strategy.customizeDocumentCommand(doc, docCmd);
+		assertEquals("\n    ", docCmd.text);
+
+	}
+
+	public void __testNewLine12() {
+		System.out.println("NewLine12\n");
+
+		String str = "" + "if False:print 'done'" + "";
+		final Document doc = new Document(str);
+		DocCmd docCmd = new DocCmd(doc.getLength() - "print 'done'".length(), 0, "\n");
+		strategy.customizeDocumentCommand(doc, docCmd);
+		assertEquals("\n    ", docCmd.text);
+	}
+
+	public void __testNewLine3() {
+		System.out.println("NewLine3\n");
+
+		String str = "for a in b:    " + "";
+		final Document doc = new Document(str);
+		DocCmd docCmd = new DocCmd(doc.getLength() - 4, 0, "\n");
+		strategy.customizeDocumentCommand(doc, docCmd);
+		assertEquals("\n    ", docCmd.text);
+
+		String expected = "for a in b:    ";
+		assertEquals(expected, doc.get());
+	}
+
+	public void __testNewLine6() {
+		System.out.println("NewLine6\n");
+
+		String str = "" + "for v in w:\n" + "    pass\n" + // dedent on pass
+				"";
+		final Document doc = new Document(str);
+		DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\n");
+		strategy.customizeDocumentCommand(doc, docCmd);
+		assertEquals("\n", docCmd.text);
+	}
+
+	public void __testNewLine6a() {
+		System.out.println("NewLine6a\n");
+
+		String str = "" + "def getSpilledComps( *dummy ):\n" + "    return [self.component4]" + // dedent
+																								// here
+				"";
+		final Document doc = new Document(str);
+		DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\n");
+		strategy.customizeDocumentCommand(doc, docCmd);
+		assertEquals("\n", docCmd.text);
+	}
+
+	public void __testNewLine7() {
+		System.out.println("NewLine7\n");
+
+		String str = "" + "class C:\n" + "    a = 30\n" + "print C.a\n" + "\n" + "";
+		final Document doc = new Document(str);
+		DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\n");
+		strategy.customizeDocumentCommand(doc, docCmd);
+		assertEquals("\n", docCmd.text);
+	}
+
+	public void __testNewLine8() {
+		System.out.println("NewLine8\n");
+
+		String str = "" + "class C:\n" + "    pass\n" + "    a = 30\n" + "    " + "";
+		final Document doc = new Document(str);
+		DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\n");
+		strategy.customizeDocumentCommand(doc, docCmd);
+		assertEquals("\n    ", docCmd.text);
+	}
+
+	public void __testIndent() {
+		System.out.println("Indent\n");
+
+		String str = "" + "while False:\n" + "    if foo:" + "";
+		final Document doc = new Document(str);
+		DocCmd docCmd = new DocCmd(doc.getLength() - "if foo:".length(), 0, "\n");
+		strategy.customizeDocumentCommand(doc, docCmd);
+		assertEquals("\n    ", docCmd.text);
+	}
+
+	public void __testIndentAfterRet() {
+		System.out.println("IndentAfterRet\n");
+
+		String str = "" + "class Foo:\n" + "    def m1():\n" + "        for a in b:\n" + "            if a = 20:\n"
+				+ "                print 'foo'\n" + "        return 30\n" + "    " + "";
+		final Document doc = new Document(str);
+		DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\n");
+		strategy.customizeDocumentCommand(doc, docCmd);
+		assertEquals("\n    ", docCmd.text);
+	}
+
+	public void __testIndentAfterRet2() {
+		System.out.println("IndentAfterRet2\n");
+
+		String str = "" + "class Foo:\n" + "    def m1():\n" + "        for a in b:\n" + "            if a = 20:\n"
+				+ "                print 'foo'\n" + "        return 30\n" + "    \n" + "";
+		final Document doc = new Document(str);
+		DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\t");
+		strategy.customizeDocumentCommand(doc, docCmd);
+		assertEquals("    ", docCmd.text);
+	}
+
+	public void __testNewLine9() {
+		System.out.println("NewLine9\n");
+
+		String str = "" + "class C:\n" + "    try:" + "";
+		final Document doc = new Document(str);
+		DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\n");
+		strategy.customizeDocumentCommand(doc, docCmd);
+		assertEquals("\n        ", docCmd.text);
+	}
+
+	public void __testNewLine4() {
+		System.out.println("NewLine4\n");
+
+		String str = "" + "def a():\n" + "    print a" + "";
+		final Document doc = new Document(str);
+		DocCmd docCmd = new DocCmd(doc.getLength() - "    print a".length(), 0, "\n");
+		strategy.customizeDocumentCommand(doc, docCmd);
+		String expected = "" + "def a():\n" + "    print a" + "";
+		assertEquals(expected, doc.get());
+		assertEquals("\n", docCmd.text);
+
+	}
+
+	public void _testNewLine5() {
+		System.out.println("NewLine5\n");
+
+		String str = "" + "def a():\n" + "    " + "";
+		final Document doc = new Document(str);
+		DocCmd docCmd = new DocCmd(doc.getLength() - "    ".length(), 0, "\n");
+		strategy.customizeDocumentCommand(doc, docCmd);
+		String expected = "" + "def a():\n" + "    " + "";
+		assertEquals(expected, doc.get());
+		assertEquals("\n", docCmd.text);
+	}
+
+	public void __testNewLine() {
+		System.out.println("NewLine\n");
+
+		String str = "createintervention() #create " + "";
+		final Document doc = new Document(str);
+		DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\n");
+		strategy.customizeDocumentCommand(doc, docCmd);
+		assertEquals("\n", docCmd.text);
+
+	}
+
+	public void __testNewLine2() {
+		System.out.println("NewLine2\n");
+
+		String str = "err)" + "";
+		final Document doc = new Document(str);
+		DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\n");
+		strategy.customizeDocumentCommand(doc, docCmd);
+		assertEquals("\n", docCmd.text);
+
+	}
+
+	public void __testTabInComment() {
+		System.out.println("TabInComment\n");
+
+		String str = "#comment" + "";
+		final Document doc = new Document(str);
+		DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\t");
+		strategy.customizeDocumentCommand(doc, docCmd);
+		assertEquals("    ", docCmd.text); // a single tab should go to the
+											// correct indent
+
+	}
+
+	public void __testIndentingWithTab() {
+		System.out.println("IndentingWithTab\n");
+
+		String str = "class C:\n" + "    def m1(self):\n" + "";
+		final Document doc = new Document(str);
+		DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\t");
+		strategy.customizeDocumentCommand(doc, docCmd);
+		assertEquals("        ", docCmd.text); // a single tab should go to the
+												// correct indent
+	}
+
+	public void __testIndentingWithTab2() {
+		System.out.println("IndentingWithTab2\n");
+
+		String str = "" + "class C:\n" + "    pass\n" + "";
+		final Document doc = new Document(str);
+		DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\t");
+		strategy.customizeDocumentCommand(doc, docCmd);
+		assertEquals("    ", docCmd.text); // a single tab should go to the
+											// correct indent
+	}
+
+	public void __testIndentingWithTab3() {
+		System.out.println("IndentingWithTab3\n");
+
+		String str = "" + "class C:\n" + "    def m1(self):            \n" + "        print 1\n" + "";
+		final Document doc = new Document(str);
+		DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\t");
+		strategy.customizeDocumentCommand(doc, docCmd);
+		assertEquals("        ", docCmd.text); // a single tab should go to the
+												// correct indent
+	}
+
+	// public void __testWithoutSmartIndent() {
+	// System.out.println("WithoutSmartIndent\n");
+	// final TestIndentPrefs prefs = new TestIndentPrefs(true, 4);
+	// prefs.smartIndentAfterPar = false;
+	//
+	// String str = "" +
+	// "class C:\n" +
+	// " def m1(self):" +
+	// "";
+	// final Document doc = new Document(str);
+	// DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\n");
+	// strategy.customizeDocumentCommand(doc, docCmd);
+	// assertEquals("\n ", docCmd.text); // a single tab should go to the
+	// correct indent
+	// }
+
+	public void __testIndentingWithTab4() {
+		System.out.println("IndentingWithTab4\n");
+
+		String str = "" + "class C:\n" + "    def m1(self):            \n" + "        print 'a'\n" + "        " + // now,
+																													// a
+																													// 'regular'
+																													// tab
+																													// should
+																													// happen
+				"";
+		final Document doc = new Document(str);
+		DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\t");
+		strategy.customizeDocumentCommand(doc, docCmd);
+		assertEquals("    ", docCmd.text); // a single tab should go to the
+											// correct indent
+	}
+
+	public void __testIndentingWithTab5() {
+		System.out.println("IndentingWithTab5\n");
+
+		String str = "" + "class C:\n" + "    def m1(self):            \n" + "        print 'a'\n" + "       " + // now,
+																													// only
+																													// 1
+																													// space
+																													// is
+																													// missing
+																													// to
+																													// the
+																													// correct
+																													// indent
+				"";
+		final Document doc = new Document(str);
+		DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\t");
+		strategy.customizeDocumentCommand(doc, docCmd);
+		// assertEquals(" ", docCmd.text); // a single tab should go to the
+		// correct indent
+		assertEquals("        ", docCmd.text);
+		assertEquals("       ".length(), docCmd.length);
+		assertEquals(doc.getLength() - "       ".length(), docCmd.offset);
+	}
+
+	public void __testIndentingWithTab6() {
+		System.out.println("IndentingWithTab6\n");
+
+		String str = "" + "class C:\n" + "    def m1(self):            \n" + "print 'a'" + "";
+		final Document doc = new Document(str);
+		DocCmd docCmd = new DocCmd(doc.getLength() - "print 'a'".length(), 0, "\t");
+		strategy.customizeDocumentCommand(doc, docCmd);
+		assertEquals("        ", docCmd.text); // a single tab should go to the
+												// correct indent
+	}
+
+	public void __testIndentingWithTab7() {
+		System.out.println("IndentingWithTab7\n");
+
+		String str = "" + "class C:\n" + "    def m1(self):            \n" + "  print 'a'" + "";
+		final Document doc = new Document(str);
+		DocCmd docCmd = new DocCmd(doc.getLength() - "  print 'a'".length(), 0, "\t");
+		strategy.customizeDocumentCommand(doc, docCmd);
+		assertEquals("        ", docCmd.text); // a single tab should go to the
+												// correct indent
+		assertEquals(2, docCmd.length); // the spaces after the indent should be
+										// removed
+	}
 
-        docCmd = new DocCmd(0, 0, "    abc"); //paste
-        strategy.customizeDocumentCommand(new Document(""), docCmd);
-        assertEquals("\tabc", docCmd.text);
-    }
+	public void _testTabs() {
+		System.out.println("Tabs\n");
 
-    public void __testCommentsIndent() { System.out.println("CommentsIndent\n");
+		DocCmd docCmd = new DocCmd(0, 0, "\t");
+		strategy.customizeDocumentCommand(new Document(""), docCmd);
+		assertEquals("\t", docCmd.text);
 
+		docCmd = new DocCmd(0, 0, "\t\t");
+		strategy.customizeDocumentCommand(new Document(""), docCmd);
+		assertEquals("\t\t", docCmd.text);
 
-        doc = "class c: #some comment";
-        docCmd = new DocCmd(doc.length(), 0, "\n");
-        strategy.customizeDocumentCommand(new Document(doc), docCmd);
-        expected = "\n" +
-                   "    ";
-        assertEquals(expected, docCmd.text);
-    }
+		docCmd = new DocCmd(0, 0, "\tabc");
+		strategy.customizeDocumentCommand(new Document(""), docCmd);
+		assertEquals("\tabc", docCmd.text);
 
-    public void _testCommentsIndent2() { System.out.println("CommentsIndent2\n");
+		docCmd = new DocCmd(0, 0, "\tabc\t");
+		strategy.customizeDocumentCommand(new Document(""), docCmd);
+		assertEquals("\tabc\t", docCmd.text);
 
-        //__test not indent more
-        doc = "    # comment:";
-        docCmd = new DocCmd(doc.length(), 0, "\n");
-        strategy.customizeDocumentCommand(new Document(doc), docCmd);
-        expected = "\n" +
-        "    ";
-        assertEquals(expected, docCmd.text);
+		docCmd = new DocCmd(0, 0, "    abc"); // paste
+		strategy.customizeDocumentCommand(new Document(""), docCmd);
+		assertEquals("\tabc", docCmd.text);
+	}
 
-        //test indent more
-        doc = "    if False:";
-        docCmd = new DocCmd(doc.length(), 0, "\n");
-        strategy.customizeDocumentCommand(new Document(doc), docCmd);
-        expected = "\n" +
-        "        ";
-        assertEquals(expected, docCmd.text);
-    }
+	public void __testCommentsIndent() {
+		System.out.println("CommentsIndent\n");
 
-    public void __testIndentLevel3() { System.out.println("IndentLevel3\n");
+		doc = "class c: #some comment";
+		docCmd = new DocCmd(doc.length(), 0, "\n");
+		strategy.customizeDocumentCommand(new Document(doc), docCmd);
+		expected = "\n" + "    ";
+		assertEquals(expected, docCmd.text);
+	}
 
+	public void _testCommentsIndent2() {
+		System.out.println("CommentsIndent2\n");
 
-    	String doc = "" +
-		"a = (1, \n" +
-		"  2,"; //should keep this indent, and not go to the opening bracket indent.
-    	DocCmd docCmd = new DocCmd(doc.length(), 0, "\n");
-    	strategy.customizeDocumentCommand(new Document(doc), docCmd);
-    	String expected = "\n  ";
-    	assertEquals(expected, docCmd.text);
-    }
+		// __test not indent more
+		doc = "    # comment:";
+		docCmd = new DocCmd(doc.length(), 0, "\n");
+		strategy.customizeDocumentCommand(new Document(doc), docCmd);
+		expected = "\n" + "    ";
+		assertEquals(expected, docCmd.text);
 
-    public void __testIndentLevel() { System.out.println("IndentLevel\n");
+		// test indent more
+		doc = "    if False:";
+		docCmd = new DocCmd(doc.length(), 0, "\n");
+		strategy.customizeDocumentCommand(new Document(doc), docCmd);
+		expected = "\n" + "        ";
+		assertEquals(expected, docCmd.text);
+	}
 
+	public void __testIndentLevel3() {
+		System.out.println("IndentLevel3\n");
 
-        String doc = "" +
-                "def m1(): #some comment\n" +
-                "    print foo(a,\n" +
-                "              b)";
-        DocCmd docCmd = new DocCmd(doc.length(), 0, "\n");
-        strategy.customizeDocumentCommand(new Document(doc), docCmd);
-        String expected = "\n    ";
-        assertEquals(expected, docCmd.text);
-    }
+		String doc = "" + "a = (1, \n" + "  2,"; // should keep this indent, and
+													// not go to the opening
+													// bracket indent.
+		DocCmd docCmd = new DocCmd(doc.length(), 0, "\n");
+		strategy.customizeDocumentCommand(new Document(doc), docCmd);
+		String expected = "\n  ";
+		assertEquals(expected, docCmd.text);
+	}
 
-    public void __testIndentLevel2() { System.out.println("IndentLevel2\n");
+	public void __testIndentLevel() {
+		System.out.println("IndentLevel\n");
 
+		String doc = "" + "def m1(): #some comment\n" + "    print foo(a,\n" + "              b)";
+		DocCmd docCmd = new DocCmd(doc.length(), 0, "\n");
+		strategy.customizeDocumentCommand(new Document(doc), docCmd);
+		String expected = "\n    ";
+		assertEquals(expected, docCmd.text);
+	}
 
-        String doc = "" +
-        "def m1(): #some comment\n" +
-        "    def metfoo(a,\n" +
-        "               b):";
-        DocCmd docCmd = new DocCmd(doc.length(), 0, "\n");
-        strategy.customizeDocumentCommand(new Document(doc), docCmd);
-        String expected = "\n        ";
-        assertEquals(expected, docCmd.text);
-    }
+	public void __testIndentLevel2() {
+		System.out.println("IndentLevel2\n");
 
-    public void __testDedent() { System.out.println("Dedent\n");
+		String doc = "" + "def m1(): #some comment\n" + "    def metfoo(a,\n" + "               b):";
+		DocCmd docCmd = new DocCmd(doc.length(), 0, "\n");
+		strategy.customizeDocumentCommand(new Document(doc), docCmd);
+		String expected = "\n        ";
+		assertEquals(expected, docCmd.text);
+	}
 
+	public void __testDedent() {
+		System.out.println("Dedent\n");
 
-        String doc = "def m1(): #some comment\n" +
-                     "    return 10";
-        DocCmd docCmd = new DocCmd(doc.length(), 0, "\n");
-        strategy.customizeDocumentCommand(new Document(doc), docCmd);
-        String expected = "\n";
-        assertEquals(expected, docCmd.text);
+		String doc = "def m1(): #some comment\n" + "    return 10";
+		DocCmd docCmd = new DocCmd(doc.length(), 0, "\n");
+		strategy.customizeDocumentCommand(new Document(doc), docCmd);
+		String expected = "\n";
+		assertEquals(expected, docCmd.text);
 
-        //test ending with
-        doc = "def m1(): #some comment\n" +
-              "    return";
-        docCmd = new DocCmd(doc.length(), 0, "\n");
-        strategy.customizeDocumentCommand(new Document(doc), docCmd);
-        expected = "\n";
-        assertEquals(expected, docCmd.text);
+		// test ending with
+		doc = "def m1(): #some comment\n" + "    return";
+		docCmd = new DocCmd(doc.length(), 0, "\n");
+		strategy.customizeDocumentCommand(new Document(doc), docCmd);
+		expected = "\n";
+		assertEquals(expected, docCmd.text);
 
-        //test not dedenting
-        doc = "def m1(): #some comment\n" +
-        "    returnIs10 = 10";
-        docCmd = new DocCmd(doc.length(), 0, "\n");
-        strategy.customizeDocumentCommand(new Document(doc), docCmd);
-        expected = "\n"+
-        "    ";
-        assertEquals(expected, docCmd.text);
+		// test not dedenting
+		doc = "def m1(): #some comment\n" + "    returnIs10 = 10";
+		docCmd = new DocCmd(doc.length(), 0, "\n");
+		strategy.customizeDocumentCommand(new Document(doc), docCmd);
+		expected = "\n" + "    ";
+		assertEquals(expected, docCmd.text);
 
-    }
+	}
 
-    public void __testIndentSpaces() { System.out.println("IndentSpaces\n");
-        //test after class xxx:\n
+	public void __testIndentSpaces() {
+		System.out.println("IndentSpaces\n");
+		// test after class xxx:\n
 
-        String doc = "class c:";
-        DocCmd docCmd = new DocCmd(doc.length(), 0, "\n");
-        strategy.customizeDocumentCommand(new Document(doc), docCmd);
-        String expected = "\n" +
-        		          "    ";
-        assertEquals(expected, docCmd.text);
+		String doc = "class c:";
+		DocCmd docCmd = new DocCmd(doc.length(), 0, "\n");
+		strategy.customizeDocumentCommand(new Document(doc), docCmd);
+		String expected = "\n" + "    ";
+		assertEquals(expected, docCmd.text);
 
-        //test regular
-        doc = "    a = 2";
-        docCmd = new DocCmd(doc.length(), 0, "\n");
-        strategy.customizeDocumentCommand(new Document(doc), docCmd);
-        expected = "\n" +
-                   "    ";
-        assertEquals(expected, docCmd.text);
+		// test regular
+		doc = "    a = 2";
+		docCmd = new DocCmd(doc.length(), 0, "\n");
+		strategy.customizeDocumentCommand(new Document(doc), docCmd);
+		expected = "\n" + "    ";
+		assertEquals(expected, docCmd.text);
 
-        /*
-        //test after [ a,\n
-        doc = "m = [a,";
-        docCmd = new DocCmd(doc.length(), 0, "\n");
-        strategy.customizeDocumentCommand(new Document(doc), docCmd);
-        expected = "\n" +
-                   "     ";
-        assertEquals(expected, docCmd.text);
-        */
-    }
+		/*
+		 * //test after [ a,\n doc = "m = [a,"; docCmd = new
+		 * DocCmd(doc.length(), 0, "\n"); strategy.customizeDocumentCommand(new
+		 * Document(doc), docCmd); expected = "\n" + "     ";
+		 * assertEquals(expected, docCmd.text);
+		 */
+	}
 
-    public void _testAfterClosePar1() { System.out.println("AfterClosePar1\n");
+	public void _testAfterClosePar1() {
+		System.out.println("AfterClosePar1\n");
 
-        String doc = "m = [a,";
-        DocCmd docCmd = new DocCmd(doc.length(), 0, "\n");
-        strategy.customizeDocumentCommand(new Document(doc), docCmd);
-        String expected = "\n" +
-        "     ";
-        assertEquals(expected, docCmd.text);
+		String doc = "m = [a,";
+		DocCmd docCmd = new DocCmd(doc.length(), 0, "\n");
+		strategy.customizeDocumentCommand(new Document(doc), docCmd);
+		String expected = "\n" + "     ";
+		assertEquals(expected, docCmd.text);
 
-    }
+	}
 
-//    public void __testAfterCloseParOnlyIndent() { System.out.println("AfterCloseParOnlyIndent\n");
-//    	final TestIndentPrefs prefs = new TestIndentPrefs(true, 4);
-//
-//		prefs.indentToParLevel = false;
-//    	String doc = "m = [a,";
-//    	DocCmd docCmd = new DocCmd(doc.length(), 0, "\n");
-//    	strategy.customizeDocumentCommand(new Document(doc), docCmd);
-//    	String expected = "\n" +
-//    	"    ";
-//    	assertEquals(expected, docCmd.text);
-//
-//    }
+	// public void __testAfterCloseParOnlyIndent() {
+	// System.out.println("AfterCloseParOnlyIndent\n");
+	// final TestIndentPrefs prefs = new TestIndentPrefs(true, 4);
+	//
+	// prefs.indentToParLevel = false;
+	// String doc = "m = [a,";
+	// DocCmd docCmd = new DocCmd(doc.length(), 0, "\n");
+	// strategy.customizeDocumentCommand(new Document(doc), docCmd);
+	// String expected = "\n" +
+	// " ";
+	// assertEquals(expected, docCmd.text);
+	//
+	// }
 
-//    public void __testAfterCloseParOnlyIndent2() { System.out.println("AfterCloseParOnlyIndent2\n");
-//    	final TestIndentPrefs prefs = new TestIndentPrefs(true, 4);
-//
-//    	prefs.indentToParLevel = false;
-//    	String doc = "" +
-//    			"class A:\n" +
-//    			"    def m1(a,";
-//    	DocCmd docCmd = new DocCmd(doc.length(), 0, "\n");
-//    	strategy.customizeDocumentCommand(new Document(doc), docCmd);
-//    	String expected = "\n" +
-//    	"        ";
-//    	assertEquals(expected, docCmd.text);
-//
-//    }
+	// public void __testAfterCloseParOnlyIndent2() {
+	// System.out.println("AfterCloseParOnlyIndent2\n");
+	// final TestIndentPrefs prefs = new TestIndentPrefs(true, 4);
+	//
+	// prefs.indentToParLevel = false;
+	// String doc = "" +
+	// "class A:\n" +
+	// " def m1(a,";
+	// DocCmd docCmd = new DocCmd(doc.length(), 0, "\n");
+	// strategy.customizeDocumentCommand(new Document(doc), docCmd);
+	// String expected = "\n" +
+	// " ";
+	// assertEquals(expected, docCmd.text);
+	//
+	// }
 
-    public void __testAfterClosePar2() { System.out.println("AfterClosePar2\n");
+	public void __testAfterClosePar2() {
+		System.out.println("AfterClosePar2\n");
 
-        String doc = "m = [a,\n" +
-                     "     b,";
-        DocCmd docCmd = new DocCmd(doc.length(), 0, "\n");
-        strategy.customizeDocumentCommand(new Document(doc), docCmd);
-        String expected = "\n" +
-        "     ";
-        assertEquals(expected, docCmd.text);
+		String doc = "m = [a,\n" + "     b,";
+		DocCmd docCmd = new DocCmd(doc.length(), 0, "\n");
+		strategy.customizeDocumentCommand(new Document(doc), docCmd);
+		String expected = "\n" + "     ";
+		assertEquals(expected, docCmd.text);
 
-    }
-    public void _testAfterClosePar() { System.out.println("AfterClosePar\n");
+	}
 
-        String doc = "m = [a, (#comment";
-        DocCmd docCmd = new DocCmd(doc.length(), 0, "\n");
-        strategy.customizeDocumentCommand(new Document(doc), docCmd);
-        String expected = "\n" +
-        "         ";
-        assertEquals(expected, docCmd.text);
+	public void _testAfterClosePar() {
+		System.out.println("AfterClosePar\n");
 
-//        doc = "m = [a, otherCall(), ]";
-//        docCmd = new DocCmd(doc.length()-1, 0, "\n"); //right before the last ']'
-//        strategy.customizeDocumentCommand(new Document(doc), docCmd);
-//        expected = "\n" +
-//        "      ";
-//        assertEquals(expected, docCmd.text);
-    }
+		String doc = "m = [a, (#comment";
+		DocCmd docCmd = new DocCmd(doc.length(), 0, "\n");
+		strategy.customizeDocumentCommand(new Document(doc), docCmd);
+		String expected = "\n" + "         ";
+		assertEquals(expected, docCmd.text);
 
-    public void _testIndent2() { System.out.println("Indent2\n");
+		// doc = "m = [a, otherCall(), ]";
+		// docCmd = new DocCmd(doc.length()-1, 0, "\n"); //right before the last
+		// ']'
+		// strategy.customizeDocumentCommand(new Document(doc), docCmd);
+		// expected = "\n" +
+		// " ";
+		// assertEquals(expected, docCmd.text);
+	}
 
-        String doc = "m = [a, otherCall(), ";
-        DocCmd docCmd = new DocCmd(doc.length(), 0, "\n");
-//        strategy.customizeDocumentCommand(new Document(doc), docCmd);
-        String expected = "\n" +
-        "      ";
-//        assertEquals(expected, docCmd.text);
-//
-//        doc = "m = [a, otherCall(), ]";
-//        docCmd = new DocCmd(doc.length()-1, 0, "\n"); //right before the last ']'
-//        strategy.customizeDocumentCommand(new Document(doc), docCmd);
-//        expected = "\n" +
-//        "      ";
-//        assertEquals(expected, docCmd.text);
+	public void _testIndent2() {
+		System.out.println("Indent2\n");
 
-        doc = "def m2(self):\n"+
-              "    m1(a, b(), )";
-        docCmd = new DocCmd(doc.length()-1, 0, "\n"); //right before the last ')'
-        strategy.customizeDocumentCommand(new Document(doc), docCmd);
-        expected = "\n" +
-              "       ";
-        assertEquals(expected, docCmd.text);
+		String doc = "m = [a, otherCall(), ";
+		DocCmd docCmd = new DocCmd(doc.length(), 0, "\n");
+		// strategy.customizeDocumentCommand(new Document(doc), docCmd);
+		String expected = "\n" + "      ";
+		// assertEquals(expected, docCmd.text);
+		//
+		// doc = "m = [a, otherCall(), ]";
+		// docCmd = new DocCmd(doc.length()-1, 0, "\n"); //right before the last
+		// ']'
+		// strategy.customizeDocumentCommand(new Document(doc), docCmd);
+		// expected = "\n" +
+		// " ";
+		// assertEquals(expected, docCmd.text);
 
-    }
+		doc = "def m2(self):\n" + "    m1(a, b(), )";
+		docCmd = new DocCmd(doc.length() - 1, 0, "\n"); // right before the last
+														// ')'
+		strategy.customizeDocumentCommand(new Document(doc), docCmd);
+		expected = "\n" + "       ";
+		assertEquals(expected, docCmd.text);
 
-    public void _testIndent3() { System.out.println("Indent3\n");
+	}
 
+	public void _testIndent3() {
+		System.out.println("Indent3\n");
 
-        String doc = ""+
-        "properties.create(a = newClass(),";
-        DocCmd docCmd = new DocCmd(doc.length(), 0, "\n");
-        strategy.customizeDocumentCommand(new Document(doc), docCmd);
-        String expected = "\n"+
-        "                  ";
-        assertEquals(expected, docCmd.text);
+		String doc = "" + "properties.create(a = newClass(),";
+		DocCmd docCmd = new DocCmd(doc.length(), 0, "\n");
+		strategy.customizeDocumentCommand(new Document(doc), docCmd);
+		String expected = "\n" + "                  ";
+		assertEquals(expected, docCmd.text);
 
-    }
-    public void __testIndent3a() { System.out.println("Indent3a\n");
+	}
 
-    	String doc = ""+
-		"properties.create(a = newClass(),\n" +
-		"                  b = newClass(),"; //don't indent after the '(' in this line, but to the default one
-    	DocCmd docCmd = new DocCmd(doc.length(), 0, "\n");
-    	strategy.customizeDocumentCommand(new Document(doc), docCmd);
-    	String expected = "\n"+
-    	"                  ";
-    	assertEquals(expected, docCmd.text);
-    }
+	public void __testIndent3a() {
+		System.out.println("Indent3a\n");
 
-    public void _testIndent4() { System.out.println("Indent4\n"); //even if it does not end with ',' we should indent in parenthesis
+		String doc = "" + "properties.create(a = newClass(),\n" + "                  b = newClass(),"; // don't
+																										// indent
+																										// after
+																										// the
+																										// '('
+																										// in
+																										// this
+																										// line,
+																										// but
+																										// to
+																										// the
+																										// default
+																										// one
+		DocCmd docCmd = new DocCmd(doc.length(), 0, "\n");
+		strategy.customizeDocumentCommand(new Document(doc), docCmd);
+		String expected = "\n" + "                  ";
+		assertEquals(expected, docCmd.text);
+	}
 
-    	String doc = ""+
-    	"properties.create(a = newClass(),\n" +
-    	"                  b = newClass("; //don't indent after the '(' in this line, but to the default one
-    	DocCmd docCmd = new DocCmd(doc.length(), 0, "\n");
-    	strategy.customizeDocumentCommand(new Document(doc), docCmd);
-    	String expected = "\n"+
-    	"                               ";
-    	assertEquals(expected, docCmd.text);
-    }
+	public void _testIndent4() {
+		System.out.println("Indent4\n"); // even if it does not end with ',' we
+											// should indent in parenthesis
 
-    public void __testDedent5() { System.out.println("Dedent5\n");
+		String doc = "" + "properties.create(a = newClass(),\n" + "                  b = newClass("; // don't
+																										// indent
+																										// after
+																										// the
+																										// '('
+																										// in
+																										// this
+																										// line,
+																										// but
+																										// to
+																										// the
+																										// default
+																										// one
+		DocCmd docCmd = new DocCmd(doc.length(), 0, "\n");
+		strategy.customizeDocumentCommand(new Document(doc), docCmd);
+		String expected = "\n" + "                               ";
+		assertEquals(expected, docCmd.text);
+	}
 
-    	String doc = ""+
-    	"properties.create(a = newClass(),\n" +
-    	"                  b = newClass(\n" +
-    	"                               )"; //go to the last indentation
-    	DocCmd docCmd = new DocCmd(doc.length(), 0, "\n");
-    	strategy.customizeDocumentCommand(new Document(doc), docCmd);
-    	String expected = "\n"+
-    	"                  ";
-    	assertEquals(expected, docCmd.text);
-    }
+	public void __testDedent5() {
+		System.out.println("Dedent5\n");
 
-//    public void __testNoSmartIndent() { System.out.println("NoSmartIndent\n");
-//
-//    	TestIndentPrefs prefs = new TestIndentPrefs(false, 4, true);
-//    	prefs.smartIndentAfterPar = false;
-//
-//
-//		String doc = null;
-//        DocCmd docCmd = null;
-//        String expected = null;
-//
-//	    //test after [ a,\n
-//        doc = "m = [a,";
-//        docCmd = new DocCmd(doc.length(), 0, "\n");
-//        strategy.customizeDocumentCommand(new Document(doc), docCmd);
-//        expected = "\n";
-//        assertEquals(expected, docCmd.text);
-//
-//        //test after \t[ a,\n
-//        doc = "\tm = [a,";
-//        docCmd = new DocCmd(doc.length(), 0, "\n");
-//        strategy.customizeDocumentCommand(new Document(doc), docCmd);
-//        expected = "\n" +
-//                   "\t";
-//        assertEquals(expected, docCmd.text);
-//
-//        //test after \t[ a,\n
-//        doc = "\tm = [a,  ";
-//        docCmd = new DocCmd(doc.length(), 0, "\n");
-//        strategy.customizeDocumentCommand(new Document(doc), docCmd);
-//        expected = "\n" +
-//                   "\t";
-//        assertEquals(expected, docCmd.text);
-//
-//    }
+		String doc = "" + "properties.create(a = newClass(),\n" + "                  b = newClass(\n"
+				+ "                               )"; // go to the last
+														// indentation
+		DocCmd docCmd = new DocCmd(doc.length(), 0, "\n");
+		strategy.customizeDocumentCommand(new Document(doc), docCmd);
+		String expected = "\n" + "                  ";
+		assertEquals(expected, docCmd.text);
+	}
 
+	// public void __testNoSmartIndent() {
+	// System.out.println("NoSmartIndent\n");
+	//
+	// TestIndentPrefs prefs = new TestIndentPrefs(false, 4, true);
+	// prefs.smartIndentAfterPar = false;
+	//
+	//
+	// String doc = null;
+	// DocCmd docCmd = null;
+	// String expected = null;
+	//
+	// //test after [ a,\n
+	// doc = "m = [a,";
+	// docCmd = new DocCmd(doc.length(), 0, "\n");
+	// strategy.customizeDocumentCommand(new Document(doc), docCmd);
+	// expected = "\n";
+	// assertEquals(expected, docCmd.text);
+	//
+	// //test after \t[ a,\n
+	// doc = "\tm = [a,";
+	// docCmd = new DocCmd(doc.length(), 0, "\n");
+	// strategy.customizeDocumentCommand(new Document(doc), docCmd);
+	// expected = "\n" +
+	// "\t";
+	// assertEquals(expected, docCmd.text);
+	//
+	// //test after \t[ a,\n
+	// doc = "\tm = [a, ";
+	// docCmd = new DocCmd(doc.length(), 0, "\n");
+	// strategy.customizeDocumentCommand(new Document(doc), docCmd);
+	// expected = "\n" +
+	// "\t";
+	// assertEquals(expected, docCmd.text);
+	//
+	// }
 
-    public void __testAutoClose() { System.out.println("AutoClose\n");
+	public void __testAutoClose() {
+		System.out.println("AutoClose\n");
 
-        String doc = "class c(object): ";
-        DocCmd docCmd = new DocCmd(doc.length(), 0, "[");
-        strategy.customizeDocumentCommand(new Document(doc), docCmd);
-        String expected = "[]";
-        assertEquals(expected, docCmd.text);
+		String doc = "class c(object): ";
+		DocCmd docCmd = new DocCmd(doc.length(), 0, "[");
+		strategy.customizeDocumentCommand(new Document(doc), docCmd);
+		String expected = "[]";
+		assertEquals(expected, docCmd.text);
 
-    }
+	}
 
-//    public void __testAutoSelf() { System.out.println("AutoSelf\n");
-//    	TestIndentPrefs testIndentPrefs = new TestIndentPrefs(false, 4, true);
-//    	testIndentPrefs.autoAddSelf = false;
-//
-//    	String doc = null;
-//    	DocCmd docCmd = null;
-//    	String expected = null;
-//
-//    	doc = "class c:\n" +
-//    	"    def met";
-//    	docCmd = new DocCmd(doc.length(), 0, "(");
-//    	strategy.customizeDocumentCommand(new Document(doc), docCmd);
-//    	expected = "():";
-//    	assertEquals(expected, docCmd.text);
-//
-//    }
+	// public void __testAutoSelf() { System.out.println("AutoSelf\n");
+	// TestIndentPrefs testIndentPrefs = new TestIndentPrefs(false, 4, true);
+	// testIndentPrefs.autoAddSelf = false;
+	//
+	// String doc = null;
+	// DocCmd docCmd = null;
+	// String expected = null;
+	//
+	// doc = "class c:\n" +
+	// " def met";
+	// docCmd = new DocCmd(doc.length(), 0, "(");
+	// strategy.customizeDocumentCommand(new Document(doc), docCmd);
+	// expected = "():";
+	// assertEquals(expected, docCmd.text);
+	//
+	// }
 
-    /**
-     * Tests automatically adding/replacing brackets, colons, and parentheses.
-     * @see PyAutoIndentStrategy
-     */
-    public void _testAutoPar() { System.out.println("AutoPar\n");
+	/**
+	 * Tests automatically adding/replacing brackets, colons, and parentheses.
+	 *
+	 * @see PyAutoIndentStrategy
+	 */
+	public void _testAutoPar() {
+		System.out.println("AutoPar\n");
 
-        String doc = "class c";
-        DocCmd docCmd = new DocCmd(doc.length(), 0, "(");
-        strategy.customizeDocumentCommand(new Document(doc), docCmd);
-        String expected = "():";
-        assertEquals(expected, docCmd.text);
+		String doc = "class c";
+		DocCmd docCmd = new DocCmd(doc.length(), 0, "(");
+		strategy.customizeDocumentCommand(new Document(doc), docCmd);
+		String expected = "():";
+		assertEquals(expected, docCmd.text);
 
-        doc = "class c:\n" +
-    		  "    def met";
-        docCmd = new DocCmd(doc.length(), 0, "(");
-        strategy.customizeDocumentCommand(new Document(doc), docCmd);
-        expected = "(self):";
-        assertEquals(expected, docCmd.text);
+		doc = "class c:\n" + "    def met";
+		docCmd = new DocCmd(doc.length(), 0, "(");
+		strategy.customizeDocumentCommand(new Document(doc), docCmd);
+		expected = "(self):";
+		assertEquals(expected, docCmd.text);
 
-        //same as above, but with tabs
-        doc = "class c:\n" +
-        "\tdef met";
-        docCmd = new DocCmd(doc.length(), 0, "(");
-        strategy.customizeDocumentCommand(new Document(doc), docCmd);
-        expected = "(self):";
-        assertEquals(expected, docCmd.text);
+		// same as above, but with tabs
+		doc = "class c:\n" + "\tdef met";
+		docCmd = new DocCmd(doc.length(), 0, "(");
+		strategy.customizeDocumentCommand(new Document(doc), docCmd);
+		expected = "(self):";
+		assertEquals(expected, docCmd.text);
 
-        doc = "class c(object): #";
-        docCmd = new DocCmd(doc.length(), 0, "(");
-        strategy.customizeDocumentCommand(new Document(doc), docCmd);
-        expected = "("; //in comment
-        assertEquals(expected, docCmd.text);
+		doc = "class c(object): #";
+		docCmd = new DocCmd(doc.length(), 0, "(");
+		strategy.customizeDocumentCommand(new Document(doc), docCmd);
+		expected = "("; // in comment
+		assertEquals(expected, docCmd.text);
 
-        doc = "def a";
-        docCmd = new DocCmd(doc.length(), 0, "(");
-        strategy.customizeDocumentCommand(new Document(doc), docCmd);
-        expected = "():";
-        assertEquals(expected, docCmd.text);
+		doc = "def a";
+		docCmd = new DocCmd(doc.length(), 0, "(");
+		strategy.customizeDocumentCommand(new Document(doc), docCmd);
+		expected = "():";
+		assertEquals(expected, docCmd.text);
 
-        doc = "a";
-        docCmd = new DocCmd(doc.length(), 0, "(");
-        strategy.customizeDocumentCommand(new Document(doc), docCmd);
-        expected = "()";
-        assertEquals(expected, docCmd.text);
+		doc = "a";
+		docCmd = new DocCmd(doc.length(), 0, "(");
+		strategy.customizeDocumentCommand(new Document(doc), docCmd);
+		expected = "()";
+		assertEquals(expected, docCmd.text);
 
-        doc = "a()";
-        docCmd = new DocCmd(doc.length()-1, 0, "(");
-        strategy.customizeDocumentCommand(new Document(doc), docCmd);
-        expected = "(";
-        assertEquals(expected, docCmd.text);
+		doc = "a()";
+		docCmd = new DocCmd(doc.length() - 1, 0, "(");
+		strategy.customizeDocumentCommand(new Document(doc), docCmd);
+		expected = "(";
+		assertEquals(expected, docCmd.text);
 
 		// test very simple ':' detection
 		doc = "def something():";
@@ -1176,9 +1122,9 @@
 		assertEquals(expected, docCmd.text);
 		assertEquals(15, docCmd.offset);
 
-		// test inputting ':' when you already have a ':', like at the end of a function declaraction
-		doc = "class c:\n" +
-				"    def __init__(self):";
+		// test inputting ':' when you already have a ':', like at the end of a
+		// function declaraction
+		doc = "class c:\n" + "    def __init__(self):";
 		docCmd = new DocCmd(doc.length() - 1, 0, ":");
 		strategy.customizeDocumentCommand(new Document(doc), docCmd);
 		expected = "";
@@ -1186,8 +1132,7 @@
 		assertEquals(32, docCmd.caretOffset);
 
 		// test inputting ':' at the end of a document
-		doc = "class c:\n" +
-				"    def __init__(self)";
+		doc = "class c:\n" + "    def __init__(self)";
 		docCmd = new DocCmd(doc.length(), 0, ":");
 		strategy.customizeDocumentCommand(new Document(doc), docCmd);
 		expected = ":";
@@ -1195,8 +1140,7 @@
 		assertEquals(31, docCmd.offset);
 
 		// test same as above, but with a comment
-		doc = "class c:\n" +
-				"    def __init__(self): # comment";
+		doc = "class c:\n" + "    def __init__(self): # comment";
 		docCmd = new DocCmd(doc.length() - 11, 0, ":");
 		strategy.customizeDocumentCommand(new Document(doc), docCmd);
 		expected = "";
@@ -1204,17 +1148,16 @@
 		assertEquals(32, docCmd.caretOffset);
 
 		// test inputting ')' at the end of a document
-		doc = "class c:\n" +
-				"    def __init__(self)";
+		doc = "class c:\n" + "    def __init__(self)";
 		docCmd = new DocCmd(doc.length(), 0, ")");
 		strategy.customizeDocumentCommand(new Document(doc), docCmd);
 		expected = ")";
 		assertEquals(expected, docCmd.text);
 		assertEquals(0, docCmd.caretOffset);
 
-		// test inputting ')' at the end of a document when it should replace a ')'
-		doc = "class c:\n" +
-				"    def __init__(self)";
+		// test inputting ')' at the end of a document when it should replace a
+		// ')'
+		doc = "class c:\n" + "    def __init__(self)";
 		docCmd = new DocCmd(doc.length() - 1, 0, ")");
 		strategy.customizeDocumentCommand(new Document(doc), docCmd);
 		expected = "";
@@ -1222,8 +1165,7 @@
 		assertEquals(31, docCmd.caretOffset);
 
 		// test inputting ')' in the middle of the document
-		doc = "def __init__(self):\n" +
-			  "   pass";
+		doc = "def __init__(self):\n" + "   pass";
 		docCmd = new DocCmd(17, 0, ")");
 		strategy.customizeDocumentCommand(new Document(doc), docCmd);
 		expected = "";
@@ -1270,268 +1212,206 @@
 		expected = "]";
 		assertEquals(expected, docCmd.text);
 		assertEquals(0, docCmd.caretOffset);
-    }
+	}
 
-    public void __testParens() { System.out.println("Parens\n");
+	public void __testParens() {
+		System.out.println("Parens\n");
 
-    	String str = "isShown() #suite()" +
-    	"";
-    	final Document doc = new Document(str);
-    	DocCmd docCmd = new DocCmd(doc.getLength()-") #suite()".length(), 0, ")");
-    	strategy.customizeDocumentCommand(doc, docCmd);
-    	assertEquals("", docCmd.text);
-    	assertEquals(9, docCmd.caretOffset);
+		String str = "isShown() #suite()" + "";
+		final Document doc = new Document(str);
+		DocCmd docCmd = new DocCmd(doc.getLength() - ") #suite()".length(), 0, ")");
+		strategy.customizeDocumentCommand(doc, docCmd);
+		assertEquals("", docCmd.text);
+		assertEquals(9, docCmd.caretOffset);
 
-    }
+	}
 
-    public void __testParens2() { System.out.println("Parens2\n");
+	public void __testParens2() {
+		System.out.println("Parens2\n");
 
-    	String str = "isShown() #suite()'" +
-    	"";
-    	final Document doc = new Document(str);
-    	DocCmd docCmd = new DocCmd(doc.getLength()-") #suite()'".length(), 0, ")");
-    	strategy.customizeDocumentCommand(doc, docCmd);
-    	assertEquals("", docCmd.text);
-    	assertEquals(9, docCmd.caretOffset);
+		String str = "isShown() #suite()'" + "";
+		final Document doc = new Document(str);
+		DocCmd docCmd = new DocCmd(doc.getLength() - ") #suite()'".length(), 0, ")");
+		strategy.customizeDocumentCommand(doc, docCmd);
+		assertEquals("", docCmd.text);
+		assertEquals(9, docCmd.caretOffset);
 
-    }
+	}
 
+	public void __testElse() {
+		System.out.println("Else\n");
+		// first part of test - simple case
 
-    public void __testElse() { System.out.println("Else\n");
-        //first part of test - simple case
+		String strDoc = "if foo:\n" + "    print a\n" + "    else";
+		int initialOffset = strDoc.length();
+		DocCmd docCmd = new DocCmd(initialOffset, 0, ":");
+		Document doc = new Document(strDoc);
+		strategy.customizeDocumentCommand(doc, docCmd);
+		String expected = ":";
+		assertEquals(docCmd.offset, initialOffset - 4);
+		assertEquals(expected, docCmd.text);
+		assertEquals("if foo:\n" + "    print a\n" + "else", doc.get());
 
-        String strDoc = "if foo:\n" +
-                     "    print a\n" +
-                     "    else";
-        int initialOffset = strDoc.length();
-        DocCmd docCmd = new DocCmd(initialOffset, 0, ":");
-        Document doc = new Document(strDoc);
-        strategy.customizeDocumentCommand(doc, docCmd);
-        String expected = ":";
-        assertEquals(docCmd.offset, initialOffset-4);
-        assertEquals(expected, docCmd.text);
-        assertEquals(
-                "if foo:\n" +
-                "    print a\n" +
-                "else",
-                doc.get());
+		// second part of test - should not dedent
 
-        //second part of test - should not dedent
+		strDoc = "if foo:\n" + "    if somethingElse:" + "        print a\n" + "    else";
+		initialOffset = strDoc.length();
+		docCmd = new DocCmd(initialOffset, 0, ":");
+		doc = new Document(strDoc);
+		strategy.customizeDocumentCommand(doc, docCmd);
+		expected = ":";
+		assertEquals(expected, docCmd.text);
+		assertEquals(docCmd.offset, initialOffset);
+		assertEquals("if foo:\n" + "    if somethingElse:" + "        print a\n" + "    else", doc.get());
 
-        strDoc =
-        "if foo:\n" +
-        "    if somethingElse:" +
-        "        print a\n" +
-        "    else";
-        initialOffset = strDoc.length();
-        docCmd = new DocCmd(initialOffset, 0, ":");
-        doc = new Document(strDoc);
-        strategy.customizeDocumentCommand(doc, docCmd);
-        expected = ":";
-        assertEquals(expected, docCmd.text);
-        assertEquals(docCmd.offset, initialOffset);
-        assertEquals(
-                "if foo:\n" +
-                "    if somethingElse:" +
-                "        print a\n" +
-                "    else",
-                doc.get());
+	}
 
-    }
+	public void _testElif() {
+		System.out.println("Elif\n");
+		// first part of test - simple case
 
-    public void _testElif() { System.out.println("Elif\n");
-    	//first part of test - simple case
+		String strDoc = "if foo:\n" + "    print a\n" + "    elif";
+		int initialOffset = strDoc.length();
+		DocCmd docCmd = new DocCmd(initialOffset, 0, " ");
+		Document doc = new Document(strDoc);
+		strategy.customizeDocumentCommand(doc, docCmd);
+		String expected = " ";
+		assertEquals(docCmd.offset, initialOffset - 4);
+		assertEquals(expected, docCmd.text);
+		assertEquals("if foo:\n" + "    print a\n" + "elif", doc.get());
 
-    	String strDoc = "if foo:\n" +
-    	"    print a\n" +
-    	"    elif";
-    	int initialOffset = strDoc.length();
-    	DocCmd docCmd = new DocCmd(initialOffset, 0, " ");
-    	Document doc = new Document(strDoc);
-    	strategy.customizeDocumentCommand(doc, docCmd);
-    	String expected = " ";
-    	assertEquals(docCmd.offset, initialOffset-4);
-    	assertEquals(expected, docCmd.text);
-    	assertEquals(
-    			"if foo:\n" +
-    			"    print a\n" +
-    			"elif",
-    			doc.get());
+		// second part of test - should not dedent
 
-    	//second part of test - should not dedent
+		strDoc = "if foo:\n" + "    if somethingElse:" + "        print a\n" + "    elif";
+		initialOffset = strDoc.length();
+		docCmd = new DocCmd(initialOffset, 0, " ");
+		doc = new Document(strDoc);
+		strategy.customizeDocumentCommand(doc, docCmd);
+		expected = " ";
+		assertEquals(expected, docCmd.text);
+		assertEquals(docCmd.offset, initialOffset);
+		assertEquals("if foo:\n" + "    if somethingElse:" + "        print a\n" + "    elif", doc.get());
 
-    	strDoc =
-    		"if foo:\n" +
-    		"    if somethingElse:" +
-    		"        print a\n" +
-    		"    elif";
-    	initialOffset = strDoc.length();
-    	docCmd = new DocCmd(initialOffset, 0, " ");
-    	doc = new Document(strDoc);
-    	strategy.customizeDocumentCommand(doc, docCmd);
-    	expected = " ";
-    	assertEquals(expected, docCmd.text);
-    	assertEquals(docCmd.offset, initialOffset);
-    	assertEquals(
-    			"if foo:\n" +
-    			"    if somethingElse:" +
-    			"        print a\n" +
-    			"    elif",
-    			doc.get());
+	}
 
-    }
+	public void __testElseInFor() {
+		System.out.println("ElseInFor\n");
+		// first part of test - simple case
 
+		String strDoc = "for i in []:\n" + "    msg=\"success at %s\" % i\n" + "    else" + "";
+		int initialOffset = strDoc.length();
+		DocCmd docCmd = new DocCmd(initialOffset, 0, ":");
+		Document doc = new Document(strDoc);
+		strategy.customizeDocumentCommand(doc, docCmd);
+		String expected = ":";
+		assertEquals(docCmd.offset, initialOffset - 4);
+		assertEquals(expected, docCmd.text);
+		assertEquals("for i in []:\n" + "    msg=\"success at %s\" % i\n" + "else" + "", doc.get());
+	}
 
-    public void __testElseInFor() { System.out.println("ElseInFor\n");
-        //first part of test - simple case
+	public void __testElseInTry() {
+		System.out.println("ElseInTry\n");
+		// first part of test - simple case
 
-        String strDoc =
-        "for i in []:\n" +
-        "    msg=\"success at %s\" % i\n" +
-        "    else" +
-        "";
-        int initialOffset = strDoc.length();
-        DocCmd docCmd = new DocCmd(initialOffset, 0, ":");
-        Document doc = new Document(strDoc);
-        strategy.customizeDocumentCommand(doc, docCmd);
-        String expected = ":";
-        assertEquals(docCmd.offset, initialOffset-4);
-        assertEquals(expected, docCmd.text);
-        assertEquals(
-                "for i in []:\n" +
-                "    msg=\"success at %s\" % i\n" +
-                "else" +
-                "",
-                doc.get());
-    }
+		String strDoc = "try:\n" + "    print a\n" + "except:\n" + "    pass\n" + "    else";
+		int initialOffset = strDoc.length();
+		DocCmd docCmd = new DocCmd(initialOffset, 0, ":");
+		Document doc = new Document(strDoc);
+		strategy.customizeDocumentCommand(doc, docCmd);
+		String expected = ":";
+		assertEquals(docCmd.offset, initialOffset - 4);
+		assertEquals(expected, docCmd.text);
+		assertEquals("try:\n" + "    print a\n" + "except:\n" + "    pass\n" + "else", doc.get());
+	}
 
-    public void __testElseInTry() { System.out.println("ElseInTry\n");
-        //first part of test - simple case
+	public void _testElifWithPar() {
+		System.out.println("ElifWithPar\n");
+		// first part of test - simple case
 
-        String strDoc =
-            "try:\n" +
-            "    print a\n" +
-            "except:\n" +
-            "    pass\n" +
-            "    else";
-        int initialOffset = strDoc.length();
-        DocCmd docCmd = new DocCmd(initialOffset, 0, ":");
-        Document doc = new Document(strDoc);
-        strategy.customizeDocumentCommand(doc, docCmd);
-        String expected = ":";
-        assertEquals(docCmd.offset, initialOffset-4);
-        assertEquals(expected, docCmd.text);
-        assertEquals(
-                "try:\n" +
-                "    print a\n" +
-                "except:\n" +
-                "    pass\n" +
-                "else",
-                doc.get());
-    }
+		String strDoc = "if foo:\n" + "    print a\n" + "    elif";
+		int initialOffset = strDoc.length();
+		DocCmd docCmd = new DocCmd(initialOffset, 0, "(");
+		Document doc = new Document(strDoc);
+		strategy.customizeDocumentCommand(doc, docCmd);
+		String expected = "()";
+		assertEquals(docCmd.offset, initialOffset - 4);
+		assertEquals(expected, docCmd.text);
+		assertEquals("if foo:\n" + "    print a\n" + "elif", doc.get());
 
-    public void _testElifWithPar() { System.out.println("ElifWithPar\n");
-    	//first part of test - simple case
+		// second part of test - should not dedent
 
-    	String strDoc = "if foo:\n" +
-    	"    print a\n" +
-    	"    elif";
-    	int initialOffset = strDoc.length();
-    	DocCmd docCmd = new DocCmd(initialOffset, 0, "(");
-    	Document doc = new Document(strDoc);
-    	strategy.customizeDocumentCommand(doc, docCmd);
-    	String expected = "()";
-    	assertEquals(docCmd.offset, initialOffset-4);
-    	assertEquals(expected, docCmd.text);
-    	assertEquals(
-    			"if foo:\n" +
-    			"    print a\n" +
-    			"elif",
-    			doc.get());
+		strDoc = "if foo:\n" + "    if somethingElse:" + "        print a\n" + "    elif";
+		initialOffset = strDoc.length();
+		docCmd = new DocCmd(initialOffset, 0, "(");
+		doc = new Document(strDoc);
+		strategy.customizeDocumentCommand(doc, docCmd);
+		expected = "()";
+		assertEquals(expected, docCmd.text);
+		assertEquals(docCmd.offset, initialOffset);
+		assertEquals("if foo:\n" + "    if somethingElse:" + "        print a\n" + "    elif", doc.get());
 
-    	//second part of test - should not dedent
+	}
 
-    	strDoc =
-    		"if foo:\n" +
-    		"    if somethingElse:" +
-    		"        print a\n" +
-    		"    elif";
-    	initialOffset = strDoc.length();
-    	docCmd = new DocCmd(initialOffset, 0, "(");
-    	doc = new Document(strDoc);
-    	strategy.customizeDocumentCommand(doc, docCmd);
-    	expected = "()";
-    	assertEquals(expected, docCmd.text);
-    	assertEquals(docCmd.offset, initialOffset);
-    	assertEquals(
-    			"if foo:\n" +
-    			"    if somethingElse:" +
-    			"        print a\n" +
-    			"    elif",
-    			doc.get());
+	public void _testAutoImportStr() {
+		System.out.println("AutoImportStr\n");
 
-    }
+		String doc = "from xxx";
+		DocCmd docCmd = new DocCmd(doc.length(), 0, " ");
+		strategy.customizeDocumentCommand(new Document(doc), docCmd);
+		String expected = " import ";
+		assertEquals(expected, docCmd.text);
 
-    public void _testAutoImportStr() { System.out.println("AutoImportStr\n");
+		doc = "from xxx import";
+		docCmd = new DocCmd(doc.length(), 0, " ");
+		strategy.customizeDocumentCommand(new Document(doc), docCmd);
+		expected = " ";
+		assertEquals(expected, docCmd.text);
 
-        String doc = "from xxx";
-        DocCmd docCmd = new DocCmd(doc.length(), 0, " ");
-        strategy.customizeDocumentCommand(new Document(doc), docCmd);
-        String expected = " import ";
-        assertEquals(expected, docCmd.text);
+		doc = "no from xxx";
+		docCmd = new DocCmd(doc.length(), 0, " ");
+		strategy.customizeDocumentCommand(new Document(doc), docCmd);
+		expected = " ";
+		assertEquals(expected, docCmd.text);
 
-        doc = "from xxx import";
-        docCmd = new DocCmd(doc.length(), 0, " ");
-        strategy.customizeDocumentCommand(new Document(doc), docCmd);
-        expected = " ";
-        assertEquals(expected, docCmd.text);
+		doc = "From xxx";
+		docCmd = new DocCmd(doc.length(), 0, " ");
+		strategy.customizeDocumentCommand(new Document(doc), docCmd);
+		expected = " ";
+		assertEquals(expected, docCmd.text);
 
-        doc = "no from xxx";
-        docCmd = new DocCmd(doc.length(), 0, " ");
-        strategy.customizeDocumentCommand(new Document(doc), docCmd);
-        expected = " ";
-        assertEquals(expected, docCmd.text);
+		doc = "from this space";
+		docCmd = new DocCmd(doc.length(), 0, " ");
+		strategy.customizeDocumentCommand(new Document(doc), docCmd);
+		expected = " ";
+		assertEquals(expected, docCmd.text);
 
-        doc = "From xxx";
-        docCmd = new DocCmd(doc.length(), 0, " ");
-        strategy.customizeDocumentCommand(new Document(doc), docCmd);
-        expected = " ";
-        assertEquals(expected, docCmd.text);
+		doc = "from";
+		docCmd = new DocCmd(doc.length(), 0, " ");
+		strategy.customizeDocumentCommand(new Document(doc), docCmd);
+		expected = " ";
+		assertEquals(expected, docCmd.text);
 
-        doc = "from this space";
-        docCmd = new DocCmd(doc.length(), 0, " ");
-        strategy.customizeDocumentCommand(new Document(doc), docCmd);
-        expected = " ";
-        assertEquals(expected, docCmd.text);
+		doc = "from xxx import yyy";
+		docCmd = new DocCmd(8, 0, " ");
+		strategy.customizeDocumentCommand(new Document(doc), docCmd);
+		expected = " ";
+		assertEquals(expected, docCmd.text);
 
-        doc = "from";
-        docCmd = new DocCmd(doc.length(), 0, " ");
-        strategy.customizeDocumentCommand(new Document(doc), docCmd);
-        expected = " ";
-        assertEquals(expected, docCmd.text);
+		doc = "from xxx #import yyy";
+		docCmd = new DocCmd(8, 0, " ");
+		strategy.customizeDocumentCommand(new Document(doc), docCmd);
+		expected = " import ";
+		assertEquals(expected, docCmd.text);
 
-        doc = "from xxx import yyy";
-        docCmd = new DocCmd(8, 0, " ");
-        strategy.customizeDocumentCommand(new Document(doc), docCmd);
-        expected = " ";
-        assertEquals(expected, docCmd.text);
-
-        doc = "from xxx #import yyy";
-        docCmd = new DocCmd(8, 0, " ");
-        strategy.customizeDocumentCommand(new Document(doc), docCmd);
-        expected = " import ";
-        assertEquals(expected, docCmd.text);
-
-    }
+	}
 
 	@Test
-    public void testBug186514() throws Exception {
-    	String prefix = "class A\n\tdef b\n\tend\n\t";
+	public void testBug186514() {
+		String prefix = "class A\n\tdef b\n\tend\n\t";
 		String postfix = "\nend";
 		String inserted = "def test1\nend\n|";
 		String expected = "\tdef test1\n\tend\n\t|";
 		doTestInsertion(prefix, postfix, inserted, expected);
-    }
-
+	}
 
 }
diff --git a/tests/org.eclipse.dltk.ruby.ui.tests/src/org/eclipse/dltk/ruby/ui/tests/internal/TestUtils.java b/tests/org.eclipse.dltk.ruby.ui.tests/src/org/eclipse/dltk/ruby/ui/tests/internal/TestUtils.java
index e933745..675e248 100644
--- a/tests/org.eclipse.dltk.ruby.ui.tests/src/org/eclipse/dltk/ruby/ui/tests/internal/TestUtils.java
+++ b/tests/org.eclipse.dltk.ruby.ui.tests/src/org/eclipse/dltk/ruby/ui/tests/internal/TestUtils.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2005, 2016 IBM Corporation and others.
+ * Copyright (c) 2005, 2017 IBM Corporation and others.
  * 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
@@ -18,7 +18,6 @@
 import org.eclipse.dltk.ruby.internal.ui.text.IRubyPartitions;
 import org.eclipse.dltk.ruby.internal.ui.text.RubyPartitionScanner;
 import org.eclipse.dltk.ui.text.util.IRangeFilter;
-import org.eclipse.jface.text.BadLocationException;
 import org.eclipse.jface.text.Document;
 import org.eclipse.jface.text.IDocument;
 import org.eclipse.jface.text.rules.FastPartitioner;
@@ -27,37 +26,28 @@
 
 	public static String getData(String filename) throws IOException {
 		File file = RubyUITestsPlugin.getDefault().getFileInPlugin(new Path(filename));
-		InputStream stream = new FileInputStream(file.getAbsolutePath());
-		int length = stream.available();
-		byte[] data = new byte[length];
-		stream.read(data);
-		stream.close();
-		return new String(data, StandardCharsets.UTF_8);
+		try (InputStream stream = new FileInputStream(file.getAbsolutePath())) {
+			int length = stream.available();
+			byte[] data = new byte[length];
+			stream.read(data);
+			return new String(data, StandardCharsets.UTF_8);
+		}
 	}
-	
+
 	/**
 	 * Installs a partitioner with <code>document</code>.
-	 * 
+	 *
 	 * @param document
 	 *            the document
 	 */
 	public static void installStuff(Document document) {
 		String[] types = new String[] { IRubyPartitions.RUBY_STRING, IRubyPartitions.RUBY_PERCENT_STRING,
 				IRubyPartitions.RUBY_COMMENT, IDocument.DEFAULT_CONTENT_TYPE };
-		FastPartitioner partitioner = new FastPartitioner(
-				new RubyPartitionScanner(), types);
+		FastPartitioner partitioner = new FastPartitioner(new RubyPartitionScanner(), types);
 		partitioner.connect(document);
-		document.setDocumentPartitioner(IRubyPartitions.RUBY_PARTITIONING,
-				partitioner);
+		document.setDocumentPartitioner(IRubyPartitions.RUBY_PARTITIONING, partitioner);
 	}
 
-	public static final IRangeFilter ALL_RANGES_ALLOWED = new IRangeFilter() {
-		
-		@Override
-		public boolean allowRange(IDocument document, int start, int length) throws BadLocationException {
-			return true;
-		}
-		
-	};
-	
+	public static final IRangeFilter ALL_RANGES_ALLOWED = (document, start, length) -> true;
+
 }
diff --git a/tests/org.eclipse.dltk.ruby.ui.tests/src/org/eclipse/dltk/ruby/ui/tests/search/MixinCompleteTests.java b/tests/org.eclipse.dltk.ruby.ui.tests/src/org/eclipse/dltk/ruby/ui/tests/search/MixinCompleteTests.java
index 9e64496..87fa07c 100644
--- a/tests/org.eclipse.dltk.ruby.ui.tests/src/org/eclipse/dltk/ruby/ui/tests/search/MixinCompleteTests.java
+++ b/tests/org.eclipse.dltk.ruby.ui.tests/src/org/eclipse/dltk/ruby/ui/tests/search/MixinCompleteTests.java
@@ -1,11 +1,10 @@
 /*******************************************************************************
- * Copyright (c) 2005, 2016 IBM Corporation and others.
+ * Copyright (c) 2005, 2017 IBM Corporation and others.
  * 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 org.eclipse.dltk.ruby.ui.tests.search;
 
@@ -37,9 +36,7 @@
 	}
 
 	private void buildAll() throws CoreException {
-		ResourcesPlugin.getWorkspace()
-				.build(IncrementalProjectBuilder.FULL_BUILD,
-						new NullProgressMonitor());
+		ResourcesPlugin.getWorkspace().build(IncrementalProjectBuilder.FULL_BUILD, new NullProgressMonitor());
 		// waitForAutoBuild();
 	}
 
@@ -55,8 +52,7 @@
 		String id = null;
 		do {
 			id = String.valueOf(System.currentTimeMillis());
-		} while (InterpreterType.findInterpreterInstall(id) != null
-				|| id.equals(fgLastUsedID));
+		} while (InterpreterType.findInterpreterInstall(id) != null || id.equals(fgLastUsedID));
 		fgLastUsedID = id;
 		return id;
 	}
@@ -68,8 +64,7 @@
 		SCRIPT_PROJECT = setUpScriptProject(PROJECT_NAME);
 	}
 
-
-	public void testMultiAccess() throws Exception {
+	public void testMultiAccess() {
 
 	}
 }
diff --git a/tests/org.eclipse.dltk.ruby.ui.tests/src/org/eclipse/dltk/ruby/ui/tests/search/ThreadedUIMixinTests.java b/tests/org.eclipse.dltk.ruby.ui.tests/src/org/eclipse/dltk/ruby/ui/tests/search/ThreadedUIMixinTests.java
index 90ae8dc..dfc85dc 100644
--- a/tests/org.eclipse.dltk.ruby.ui.tests/src/org/eclipse/dltk/ruby/ui/tests/search/ThreadedUIMixinTests.java
+++ b/tests/org.eclipse.dltk.ruby.ui.tests/src/org/eclipse/dltk/ruby/ui/tests/search/ThreadedUIMixinTests.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2005, 2016 IBM Corporation and others.
+ * Copyright (c) 2005, 2017 IBM Corporation and others.
  * 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
@@ -37,9 +37,7 @@
 	}
 
 	private void buildAll() throws CoreException {
-		ResourcesPlugin.getWorkspace()
-				.build(IncrementalProjectBuilder.FULL_BUILD,
-						new NullProgressMonitor());
+		ResourcesPlugin.getWorkspace().build(IncrementalProjectBuilder.FULL_BUILD, new NullProgressMonitor());
 		// waitForAutoBuild();
 	}
 
@@ -55,8 +53,7 @@
 		String id = null;
 		do {
 			id = String.valueOf(System.currentTimeMillis());
-		} while (InterpreterType.findInterpreterInstall(id) != null
-				|| id.equals(fgLastUsedID));
+		} while (InterpreterType.findInterpreterInstall(id) != null || id.equals(fgLastUsedID));
 		fgLastUsedID = id;
 		return id;
 	}
@@ -76,8 +73,7 @@
 		public boolean finish = false;
 		private final RubyMixinModel mixinModel;
 
-		public Access(RubyMixinModel mixinModel, String keys[], int start,
-				int stop, int cycles) {
+		public Access(RubyMixinModel mixinModel, String keys[], int start, int stop, int cycles) {
 			this.mixinModel = mixinModel;
 			this.start = start;
 			this.stop = stop;
@@ -98,39 +94,20 @@
 		}
 	}
 
-	class AccessUI extends Access {
-
-		public AccessUI(RubyMixinModel mixinModel, String[] keys, int start,
-				int stop, int cycles) {
-			super(mixinModel, keys, start, stop, cycles);
-			// TODO Auto-generated constructor stub
-		}
-
-		@Override
-		public void run() {
-			// TODO Auto-generated method stub
-			// this.notifyAll();
-			super.run();
-		}
-
-	}
-
 	public void testMultiAccess() throws Exception {
 		int count = 10;
 		final RubyMixinModel mixinModel = RubyMixinModel.getWorkspaceInstance();
-		String[] findKeys = mixinModel.getRawModel().findKeys("*");
+		String[] findKeys = mixinModel.getRawModel().findKeys("*", new NullProgressMonitor());
 		Thread[] threads = new Thread[count - 1];
 		Access[] access = new Access[count];
 		int d = findKeys.length / count;
 		for (int i = 0; i < count; i++) {
 			if (i != count - 1) {
-				Access a = new Access(mixinModel, findKeys, d * (i), d
-						* (i + 1), 1);
+				Access a = new Access(mixinModel, findKeys, d * (i), d * (i + 1), 1);
 				access[i] = a;
 				threads[i] = new Thread(a);
 			} else {
-				Access a = new AccessUI(mixinModel, findKeys, d * (i),
-						findKeys.length, 10);
+				Access a = new Access(mixinModel, findKeys, d * (i), findKeys.length, 10);
 				access[i] = a;
 				// threads[i] = new Thread(a);
 			}