Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2016-02-19 06:42:34 +0000
committerAlexander Kurtakov2016-02-19 06:42:34 +0000
commit7bb252ce081ff886475ba1eb8acc4eeda99f6267 (patch)
treeb97bdad0eb5c1518e57c737b8cf96922635f67c1 /org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests
parent406539b07bfefe96f008098522f257fc91183415 (diff)
downloadeclipse.platform.ua-7bb252ce081ff886475ba1eb8acc4eeda99f6267.tar.gz
eclipse.platform.ua-7bb252ce081ff886475ba1eb8acc4eeda99f6267.tar.xz
eclipse.platform.ua-7bb252ce081ff886475ba1eb8acc4eeda99f6267.zip
Bug 488072 - Move o.e.ua.tests to Java 8
Fix all the new warnings: * try-with-resources * useless type definitions Change-Id: Ib03065e19467d1ce094fe2345ee391f2a987b781 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
Diffstat (limited to 'org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests')
-rw-r--r--org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/composite/TestPersistence.java4
-rw-r--r--org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/composite/TestTaskEvents.java2
-rw-r--r--org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/execution/CommandHandler.java4
-rw-r--r--org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/other/TestStatePersistence.java10
-rw-r--r--org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/util/CheatSheetModelSerializerTest.java7
5 files changed, 14 insertions, 13 deletions
diff --git a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/composite/TestPersistence.java b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/composite/TestPersistence.java
index 1900c7fa4..366f75a39 100644
--- a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/composite/TestPersistence.java
+++ b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/composite/TestPersistence.java
@@ -142,11 +142,11 @@ public class TestPersistence {
@Test
public void testSaveLayoutData() {
createCompositeCheatSheet();
- Map<String, String> values = new Hashtable<String, String>();
+ Map<String, String> values = new Hashtable<>();
values.put("One", "1");
values.put("Two", "2");
helper.saveCompositeState(model, values);
- Map<String, String> restoredValues = new Hashtable<String, String>();
+ Map<String, String> restoredValues = new Hashtable<>();
createCompositeCheatSheet();
model.loadState(restoredValues);
assertEquals(2, restoredValues.size());
diff --git a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/composite/TestTaskEvents.java b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/composite/TestTaskEvents.java
index 4430396ef..b47bd640a 100644
--- a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/composite/TestTaskEvents.java
+++ b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/composite/TestTaskEvents.java
@@ -38,7 +38,7 @@ public class TestTaskEvents {
public class TaskMap {
- private Map<String, TaskCounter> map = new HashMap<String, TaskCounter>();
+ private Map<String, TaskCounter> map = new HashMap<>();
private int eventCount = 0;
public void put(ICompositeCheatSheetTask task) {
diff --git a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/execution/CommandHandler.java b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/execution/CommandHandler.java
index 98a1610c1..1ec452102 100644
--- a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/execution/CommandHandler.java
+++ b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/execution/CommandHandler.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2015 IBM Corporation and others.
+ * Copyright (c) 2005, 2016 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
@@ -43,7 +43,7 @@ public class CommandHandler extends AbstractHandler {
throw new RuntimeException();
}
// Copy all the parameters
- params = new HashMap<String, String>();
+ params = new HashMap<>();
params.putAll(event.getParameters());
timesCompleted++;
diff --git a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/other/TestStatePersistence.java b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/other/TestStatePersistence.java
index 4fe36345b..9d1caa57c 100644
--- a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/other/TestStatePersistence.java
+++ b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/other/TestStatePersistence.java
@@ -68,11 +68,11 @@ public class TestStatePersistence {
propsToSave.currentItem = 2;
propsToSave.id = TEST_ID;
propsToSave.contentPath = PATH;
- propsToSave.completed = new ArrayList<String>();
- propsToSave.expanded = new ArrayList<String>();
- propsToSave.expandRestore = new ArrayList<String>();
- propsToSave.subItemCompleted = new Hashtable<String, String>();
- propsToSave.subItemSkipped = new Hashtable<String, String>();
+ propsToSave.completed = new ArrayList<>();
+ propsToSave.expanded = new ArrayList<>();
+ propsToSave.expandRestore = new ArrayList<>();
+ propsToSave.subItemCompleted = new Hashtable<>();
+ propsToSave.subItemSkipped = new Hashtable<>();
CheatSheetElement csElement = new CheatSheetElement(TEST_ID);
propsToSave.manager = new CheatSheetManager(csElement);
}
diff --git a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/util/CheatSheetModelSerializerTest.java b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/util/CheatSheetModelSerializerTest.java
index 1d6de2db9..14c270b6d 100644
--- a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/util/CheatSheetModelSerializerTest.java
+++ b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/util/CheatSheetModelSerializerTest.java
@@ -50,9 +50,10 @@ public class CheatSheetModelSerializerTest {
CheatSheet sheet = (CheatSheet)parser.parse(url, UserAssistanceTestPlugin.getPluginId(), CheatSheetParser.ANY);
Assert.assertNotNull("Tried parsing a valid cheat sheet but parser returned null: " + url, sheet);
- PrintWriter out = new PrintWriter(new FileOutputStream(FileUtil.getResultFile(url.toString().substring("file:/".length()))));
- out.print(CheatSheetModelSerializer.serialize(sheet));
- out.close();
+ try (PrintWriter out = new PrintWriter(
+ new FileOutputStream(FileUtil.getResultFile(url.toString().substring("file:/".length()))))) {
+ out.print(CheatSheetModelSerializer.serialize(sheet));
+ }
}
}
}

Back to the top