cleanup: o.e.dltk.javascript.formatter.tests

* Deprecations
* Bump BREE to Java 1.8
* Missing @Override by either adding it or converting to lambda.

Change-Id: Ie80f718c8fefd6cb21435fff14bc6b643ab2338c
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
diff --git a/tests/org.eclipse.dltk.javascript.formatter.tests/.classpath b/tests/org.eclipse.dltk.javascript.formatter.tests/.classpath
index ad32c83..eca7bdb 100644
--- a/tests/org.eclipse.dltk.javascript.formatter.tests/.classpath
+++ b/tests/org.eclipse.dltk.javascript.formatter.tests/.classpath
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
-	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
 	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
 	<classpathentry kind="src" path="src"/>
 	<classpathentry kind="output" path="bin"/>
diff --git a/tests/org.eclipse.dltk.javascript.formatter.tests/.settings/org.eclipse.jdt.core.prefs b/tests/org.eclipse.dltk.javascript.formatter.tests/.settings/org.eclipse.jdt.core.prefs
index 8717e6c..5356a08 100644
--- a/tests/org.eclipse.dltk.javascript.formatter.tests/.settings/org.eclipse.jdt.core.prefs
+++ b/tests/org.eclipse.dltk.javascript.formatter.tests/.settings/org.eclipse.jdt.core.prefs
@@ -1,14 +1,14 @@
 eclipse.preferences.version=1
 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.6
+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.assertIdentifier=error
 org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.jdt.core.compiler.source=1.8
 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
diff --git a/tests/org.eclipse.dltk.javascript.formatter.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.dltk.javascript.formatter.tests/META-INF/MANIFEST.MF
index 792b39c..c492670 100644
--- a/tests/org.eclipse.dltk.javascript.formatter.tests/META-INF/MANIFEST.MF
+++ b/tests/org.eclipse.dltk.javascript.formatter.tests/META-INF/MANIFEST.MF
@@ -4,7 +4,7 @@
 Bundle-Vendor: Eclipse DLTK
 Bundle-SymbolicName: org.eclipse.dltk.javascript.formatter.tests;singleton:=true
 Bundle-Version: 5.6.0.qualifier
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
 Require-Bundle: org.eclipse.dltk.core;bundle-version="0.0.0",
  org.eclipse.dltk.formatter.tests,
  org.eclipse.dltk.ui,
diff --git a/tests/org.eclipse.dltk.javascript.formatter.tests/src/org/eclipse/dltk/javascript/formatter/tests/JavaScriptFormatterTestsPlugin.java b/tests/org.eclipse.dltk.javascript.formatter.tests/src/org/eclipse/dltk/javascript/formatter/tests/JavaScriptFormatterTestsPlugin.java
index caa615f..17f48db 100644
--- a/tests/org.eclipse.dltk.javascript.formatter.tests/src/org/eclipse/dltk/javascript/formatter/tests/JavaScriptFormatterTestsPlugin.java
+++ b/tests/org.eclipse.dltk.javascript.formatter.tests/src/org/eclipse/dltk/javascript/formatter/tests/JavaScriptFormatterTestsPlugin.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2009 xored software, Inc.  
+ * Copyright (c) 2009, 2016 xored software, Inc. and others.
  *
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
@@ -85,21 +85,23 @@
 
 	public static final IScriptedTestContext CONTEXT = new IScriptedTestContext() {
 
+		@Override
 		public Bundle getResourceBundle() {
 			return getDefault().getBundle();
 		}
 
+		@Override
 		public String getCharset() {
 			return "ISO-8859-1"; //$NON-NLS-1$
 		}
 
+		@Override
 		public IScriptFormatter createFormatter(Map<String, Object> preferences) {
 			final Map<String, Object> prefs = JavaScriptFormatterConstants
 					.getDefaults();
-			prefs
-					.put(
-							JavaScriptFormatterConstants.INSERT_SPACE_BEFORE_LP_FUNCTION_ARGUMENTS,
-							true);
+			prefs.put(
+					JavaScriptFormatterConstants.INSERT_SPACE_BEFORE_LP_FUNCTION_ARGUMENTS,
+					true);
 			prefs.put(JavaScriptFormatterConstants.INDENT_SWITCH, true);
 			if (preferences != null) {
 				prefs.putAll(preferences);
@@ -107,6 +109,7 @@
 			return new TestJavaScriptFormatter(Util.LINE_SEPARATOR, prefs);
 		}
 
+		@Override
 		public String validateOptionName(String name) {
 			if (JavaScriptFormatterConstants.isDefined(name))
 				return name;
@@ -114,6 +117,7 @@
 			return null;
 		}
 
+		@Override
 		public String validateOptionValue(String name, String value) {
 			if (!JavaScriptFormatterConstants.isDefined(name))
 				return null;
diff --git a/tests/org.eclipse.dltk.javascript.formatter.tests/src/org/eclipse/dltk/javascript/formatter/tests/JavaScriptLibTest.java b/tests/org.eclipse.dltk.javascript.formatter.tests/src/org/eclipse/dltk/javascript/formatter/tests/JavaScriptLibTest.java
index b1b01ac..f188dfa 100644
--- a/tests/org.eclipse.dltk.javascript.formatter.tests/src/org/eclipse/dltk/javascript/formatter/tests/JavaScriptLibTest.java
+++ b/tests/org.eclipse.dltk.javascript.formatter.tests/src/org/eclipse/dltk/javascript/formatter/tests/JavaScriptLibTest.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2009 xored software, Inc.  
+ * Copyright (c) 2009, 2016 xored software, Inc. and others.
  *
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
@@ -21,7 +21,6 @@
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipInputStream;
 
-import junit.framework.Assert;
 import junit.framework.AssertionFailedError;
 import junit.framework.TestCase;
 import junit.framework.TestSuite;
@@ -38,6 +37,7 @@
 import org.eclipse.jface.text.Document;
 import org.eclipse.jface.text.IDocument;
 import org.eclipse.text.edits.TextEdit;
+import org.junit.Assert;
 
 public class JavaScriptLibTest extends AbstractFormatterTest {
 
@@ -56,6 +56,7 @@
 					.getName());
 			suite.addTest(new TestCase("testJavaScriptLib-NOT-FOUND") {
 
+				@Override
 				protected void runTest() throws Throwable {
 					System.out.println(FILENAME + " not found");
 				}
@@ -65,9 +66,10 @@
 		}
 	}
 
-	protected IScriptFormatter createFormatter(Map preferences) {
-		return preferences != null ? new TestJavaScriptFormatter(
-				Util.LINE_SEPARATOR, preferences)
+	@Override
+	protected IScriptFormatter createFormatter(Map<String, Object> preferences) {
+		return preferences != null
+				? new TestJavaScriptFormatter(Util.LINE_SEPARATOR, preferences)
 				: new TestJavaScriptFormatter();
 	}
 
@@ -87,14 +89,14 @@
 		if (!path.isFile()) {
 			fail(path + " is not found"); //$NON-NLS-1$
 		}
-		final ZipInputStream zipInputStream = new ZipInputStream(
-				new FileInputStream(path));
-		try {
+		try (final ZipInputStream zipInputStream = new ZipInputStream(
+				new FileInputStream(path))) {
 			ZipEntry entry;
 			while ((entry = zipInputStream.getNextEntry()) != null) {
 				if (!entry.isDirectory() && isJavaScriptFile(entry.getName())) {
 					final InputStream entryStream = new FilterInputStream(
 							zipInputStream) {
+						@Override
 						public void close() throws IOException {
 							// empty
 						}
@@ -134,12 +136,6 @@
 					zipInputStream.closeEntry();
 				}
 			}
-		} finally {
-			try {
-				zipInputStream.close();
-			} catch (IOException e) {
-				//
-			}
 		}
 		if (errorCount > 0) {
 			final String msg = "Syntax errors: " + errorCount;
diff --git a/tests/org.eclipse.dltk.javascript.formatter.tests/src/org/eclipse/dltk/javascript/internal/parser/tests/ANTLRParserTester.java b/tests/org.eclipse.dltk.javascript.formatter.tests/src/org/eclipse/dltk/javascript/internal/parser/tests/ANTLRParserTester.java
index cd3efdd..2a8bca1 100644
--- a/tests/org.eclipse.dltk.javascript.formatter.tests/src/org/eclipse/dltk/javascript/internal/parser/tests/ANTLRParserTester.java
+++ b/tests/org.eclipse.dltk.javascript.formatter.tests/src/org/eclipse/dltk/javascript/internal/parser/tests/ANTLRParserTester.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2009 xored software, Inc.  
+ * Copyright (c) 2009, 2016 xored software, Inc. and others.
  *
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
@@ -16,8 +16,6 @@
 import java.io.InputStream;
 import java.util.List;
 
-import junit.framework.Assert;
-
 import org.antlr.runtime.RecognitionException;
 import org.antlr.runtime.Token;
 import org.eclipse.dltk.compiler.env.ModuleSource;
@@ -29,6 +27,7 @@
 import org.eclipse.dltk.javascript.parser.JSTransformer;
 import org.eclipse.dltk.javascript.parser.JavaScriptParser;
 import org.eclipse.dltk.javascript.parser.tests.ASTVerifier;
+import org.junit.Assert;
 
 @SuppressWarnings("nls")
 public class ANTLRParserTester {
diff --git a/tests/org.eclipse.dltk.javascript.formatter.tests/src/org/eclipse/dltk/javascript/internal/parser/tests/ANTLRTokenStreamComparer.java b/tests/org.eclipse.dltk.javascript.formatter.tests/src/org/eclipse/dltk/javascript/internal/parser/tests/ANTLRTokenStreamComparer.java
index 018ba2b..80d1591 100644
--- a/tests/org.eclipse.dltk.javascript.formatter.tests/src/org/eclipse/dltk/javascript/internal/parser/tests/ANTLRTokenStreamComparer.java
+++ b/tests/org.eclipse.dltk.javascript.formatter.tests/src/org/eclipse/dltk/javascript/internal/parser/tests/ANTLRTokenStreamComparer.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2009 xored software, Inc.  
+ * Copyright (c) 2009, 2016 xored software, Inc. and others.
  *
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
@@ -14,12 +14,11 @@
 import java.util.ArrayList;
 import java.util.List;
 
-import junit.framework.Assert;
-
 import org.antlr.runtime.Token;
 import org.eclipse.dltk.javascript.parser.JSParser;
 import org.eclipse.dltk.javascript.parser.JSTokenStream;
 import org.eclipse.dltk.javascript.parser.JavaScriptParser;
+import org.junit.Assert;
 
 public class ANTLRTokenStreamComparer {
 
@@ -72,14 +71,14 @@
 		for (int i = 0; i < Math.max(sourceComments.size(),
 				targetComments.size()); i++) {
 
-			System.out
-					.println("==============================================================");
-			System.out.println(i < sourceComments.size() ? sourceComments
-					.get(i) : "!!! MISSED !!!");
-			System.out
-					.println("--------------------------------------------------------------");
-			System.out.println(i < targetComments.size() ? targetComments
-					.get(i) : "!!! MISSED !!!");
+			System.out.println(
+					"==============================================================");
+			System.out.println(i < sourceComments.size() ? sourceComments.get(i)
+					: "!!! MISSED !!!");
+			System.out.println(
+					"--------------------------------------------------------------");
+			System.out.println(i < targetComments.size() ? targetComments.get(i)
+					: "!!! MISSED !!!");
 
 		}
 		System.out
diff --git a/tests/org.eclipse.dltk.javascript.formatter.tests/src/org/eclipse/dltk/javascript/internal/parser/tests/JavaScriptParserTester.java b/tests/org.eclipse.dltk.javascript.formatter.tests/src/org/eclipse/dltk/javascript/internal/parser/tests/JavaScriptParserTester.java
index 6ddb17b..f9aa49a 100644
--- a/tests/org.eclipse.dltk.javascript.formatter.tests/src/org/eclipse/dltk/javascript/internal/parser/tests/JavaScriptParserTester.java
+++ b/tests/org.eclipse.dltk.javascript.formatter.tests/src/org/eclipse/dltk/javascript/internal/parser/tests/JavaScriptParserTester.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2009 xored software, Inc.  
+ * Copyright (c) 2009, 2016 xored software, Inc. and others.
  *
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
@@ -12,14 +12,13 @@
 
 package org.eclipse.dltk.javascript.internal.parser.tests;
 
-import junit.framework.Assert;
-
 import org.eclipse.dltk.javascript.formatter.JavaScriptFormatter;
 import org.eclipse.dltk.javascript.formatter.JavaScriptFormatterConstants;
 import org.eclipse.dltk.javascript.formatter.tests.JavaScriptFormatterTestsPlugin;
 import org.eclipse.dltk.ui.formatter.IScriptFormatter;
 import org.eclipse.jface.text.Document;
 import org.eclipse.text.edits.TextEdit;
+import org.junit.Assert;
 
 public class JavaScriptParserTester extends AbstractTester {
 
@@ -58,8 +57,8 @@
 
 	public static void parse(String resourceName, String charset)
 			throws Exception {
-		new JavaScriptParserTester().parseScript(getScriptContent(resourceName,
-				charset));
+		new JavaScriptParserTester()
+				.parseScript(getScriptContent(resourceName, charset));
 	}
 
 	public static void parseSource(String source) throws Exception {
diff --git a/tests/org.eclipse.dltk.javascript.formatter.tests/src/org/eclipse/dltk/javascript/internal/parser/tests/JavaScriptTokenStreamTester.java b/tests/org.eclipse.dltk.javascript.formatter.tests/src/org/eclipse/dltk/javascript/internal/parser/tests/JavaScriptTokenStreamTester.java
index 60990dd..98627e3 100644
--- a/tests/org.eclipse.dltk.javascript.formatter.tests/src/org/eclipse/dltk/javascript/internal/parser/tests/JavaScriptTokenStreamTester.java
+++ b/tests/org.eclipse.dltk.javascript.formatter.tests/src/org/eclipse/dltk/javascript/internal/parser/tests/JavaScriptTokenStreamTester.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2009 xored software, Inc.  
+ * Copyright (c) 2009, 2016 xored software, Inc. and others.
  *
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
@@ -14,16 +14,14 @@
 import java.io.IOException;
 import java.util.List;
 
-import junit.framework.Assert;
-
 import org.antlr.runtime.Token;
 import org.eclipse.dltk.compiler.env.ModuleSource;
-import org.eclipse.dltk.compiler.problem.IProblem;
 import org.eclipse.dltk.compiler.problem.IProblemReporter;
 import org.eclipse.dltk.javascript.ast.Script;
 import org.eclipse.dltk.javascript.formatter.tests.JavaScriptFormatterTestsPlugin;
 import org.eclipse.dltk.javascript.parser.JSTokenStream;
 import org.eclipse.dltk.javascript.parser.JavaScriptParser;
+import org.junit.Assert;
 
 public class JavaScriptTokenStreamTester extends AbstractTester {
 
@@ -60,19 +58,9 @@
 		JavaScriptParser parser = new JavaScriptParser();
 
 		Script root = parser.parse(new ModuleSource(source),
-				new IProblemReporter() {
-
-					public void reportProblem(IProblem problem) {
-						System.out.println("Parser "
-								+ (problem.isError() ? "error" : "warning")
-								+ ": " + problem.getMessage());
-					}
-
-					public Object getAdapter(
-							@SuppressWarnings("rawtypes") Class adapter) {
-						return null;
-					}
-				});
+				(IProblemReporter) problem -> System.out.println("Parser "
+						+ (problem.isError() ? "error" : "warning")
+						+ ": " + problem.getMessage()));
 
 		Assert.assertNotNull(root);