Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWim Jongman2018-03-23 07:35:00 -0400
committerWim Jongman2018-03-26 04:30:55 -0400
commitbf1e2522171fd0980012ed3acc2af48c1b8a1456 (patch)
tree44ee46bc2902e22b65c3ea648fe336c6d98943f1 /org.eclipse.tips.tests
parent3bd3703436e3dda09d1ef500cc16e7fb852b9710 (diff)
downloadeclipse.platform.ua-bf1e2522171fd0980012ed3acc2af48c1b8a1456.tar.gz
eclipse.platform.ua-bf1e2522171fd0980012ed3acc2af48c1b8a1456.tar.xz
eclipse.platform.ua-bf1e2522171fd0980012ed3acc2af48c1b8a1456.zip
Bug 531863: [Tips] Unit testsI20180327-0630I20180326-2000
* Compile error fixed * Warnings removed * Replaced 'new Integer(n)' with Integer.valueOf(n) Change-Id: I83e76f2b64448793e41f9831c14eebe6c29c6dbb Signed-off-by: Wim Jongman <wim.jongman@remainsoftware.com>
Diffstat (limited to 'org.eclipse.tips.tests')
-rw-r--r--org.eclipse.tips.tests/.settings/org.eclipse.jdt.ui.prefs59
-rw-r--r--org.eclipse.tips.tests/src/org/eclipse/tips/core/TestTipManager.java6
-rw-r--r--org.eclipse.tips.tests/src/org/eclipse/tips/core/TipManagerTest.java1
-rw-r--r--org.eclipse.tips.tests/src/org/eclipse/tips/core/TipProviderTest.java2
-rw-r--r--org.eclipse.tips.tests/src/org/eclipse/tips/core/TipTest.java41
-rw-r--r--org.eclipse.tips.tests/src/org/eclipse/tips/manual/tests/SleakTipManager.java2
6 files changed, 89 insertions, 22 deletions
diff --git a/org.eclipse.tips.tests/.settings/org.eclipse.jdt.ui.prefs b/org.eclipse.tips.tests/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 000000000..088036331
--- /dev/null
+++ b/org.eclipse.tips.tests/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,59 @@
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+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_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.insert_inferred_type_arguments=false
+sp_cleanup.make_local_variable_final=true
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=false
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=false
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_redundant_type_arguments=false
+sp_cleanup.remove_trailing_whitespaces=false
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=false
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_anonymous_class_creation=false
+sp_cleanup.use_blocks=false
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_lambda=true
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/org.eclipse.tips.tests/src/org/eclipse/tips/core/TestTipManager.java b/org.eclipse.tips.tests/src/org/eclipse/tips/core/TestTipManager.java
index 59ab3f1d4..83e17480b 100644
--- a/org.eclipse.tips.tests/src/org/eclipse/tips/core/TestTipManager.java
+++ b/org.eclipse.tips.tests/src/org/eclipse/tips/core/TestTipManager.java
@@ -45,13 +45,13 @@ public class TestTipManager extends TipManager {
@Override
public boolean isRead(Tip tip) {
- return fReadList.contains(tip.hashCode());
+ return fReadList.contains(Integer.valueOf(tip.hashCode()));
}
@Override
public TipManager setAsRead(Tip tip) {
- fReadList.remove((Integer) tip.hashCode());
- fReadList.add(tip.hashCode());
+ fReadList.remove(Integer.valueOf(tip.hashCode()));
+ fReadList.add(Integer.valueOf(tip.hashCode()));
return this;
}
diff --git a/org.eclipse.tips.tests/src/org/eclipse/tips/core/TipManagerTest.java b/org.eclipse.tips.tests/src/org/eclipse/tips/core/TipManagerTest.java
index f9d5c563e..a7363f29d 100644
--- a/org.eclipse.tips.tests/src/org/eclipse/tips/core/TipManagerTest.java
+++ b/org.eclipse.tips.tests/src/org/eclipse/tips/core/TipManagerTest.java
@@ -22,6 +22,7 @@ import org.eclipse.tips.core.internal.LogUtil;
import org.junit.Before;
import org.junit.Test;
+@SuppressWarnings("restriction")
public class TipManagerTest {
private TestTipManager fManager;
diff --git a/org.eclipse.tips.tests/src/org/eclipse/tips/core/TipProviderTest.java b/org.eclipse.tips.tests/src/org/eclipse/tips/core/TipProviderTest.java
index f56013e64..26eba8ee8 100644
--- a/org.eclipse.tips.tests/src/org/eclipse/tips/core/TipProviderTest.java
+++ b/org.eclipse.tips.tests/src/org/eclipse/tips/core/TipProviderTest.java
@@ -15,7 +15,6 @@ import static org.junit.Assert.assertTrue;
import java.util.Arrays;
import java.util.Collections;
-import java.util.List;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
@@ -64,7 +63,6 @@ public class TipProviderTest {
fManager.setAsRead(fProvider.getNextTip());
assertTrue(fProvider.getTips(false).size() == 2);
assertTrue(fProvider.getTips(false).size() == 2);
- List<Tip> tips = fProvider.getTips(true);
assertTrue(fProvider.getTips(true).size() == 1);
((TipManager) fProvider.getManager()).setServeReadTips(true);
assertTrue(fProvider.getTips(false).size() == 2);
diff --git a/org.eclipse.tips.tests/src/org/eclipse/tips/core/TipTest.java b/org.eclipse.tips.tests/src/org/eclipse/tips/core/TipTest.java
index 81e4a09e9..eabfc5738 100644
--- a/org.eclipse.tips.tests/src/org/eclipse/tips/core/TipTest.java
+++ b/org.eclipse.tips.tests/src/org/eclipse/tips/core/TipTest.java
@@ -60,7 +60,7 @@ public class TipTest {
@Test
public void testTip() {
- new TestTip(fProvider.getID(),HTML, SUBJECT_TIP);
+ new TestTip(fProvider.getID(), HTML, SUBJECT_TIP);
}
@Test
@@ -95,9 +95,8 @@ public class TipTest {
@Test
public void testEqualsObject() {
- TestTip testTip = new TestTip(fProvider.getID(),HTML, SUBJECT_TIP);
- TestTip testTipx = new TestTip(fProvider.getID(),HTML, SUBJECT_TIP);
- assertTrue(!testTip.equals("hello"));
+ TestTip testTip = new TestTip(fProvider.getID(), HTML, SUBJECT_TIP);
+ TestTip testTipx = new TestTip(fProvider.getID(), HTML, SUBJECT_TIP);
assertTrue(!testTip.equals(null));
assertTrue(testTip.equals(testTip));
assertTrue(!testTip.equals(fTip));
@@ -109,13 +108,6 @@ public class TipTest {
return "sss";
}
};
- TestTip testTip2 = new TestTip(fProvider.getID(),HTML, SUBJECT_TIP + "DDD");
- assertTrue(!testTip.equals(testTip2));
- assertTrue(!testTip.equals(testTip2));
-
- TestTip testTip3 = new TestTip(fProvider.getID(),HTML, SUBJECT_TIP + "DDD");
- assertTrue(!testTip.equals(testTip3));
- assertTrue(!testTip3.equals(testTip));
TestTipProvider testTipProvider2 = new TestTipProvider() {
@Override
@@ -124,15 +116,32 @@ public class TipTest {
}
};
+ TestTipProvider testTipProvider3 = new TestTipProvider() {
+ @Override
+ public String getID() {
+ return "sss";
+ }
+ };
+
+ assertTrue(!testTipProvider.equals(testTipProvider2));
+ assertTrue(!testTipProvider.equals(testTipProvider3));
+ TestTip testTip2 = new TestTip(fProvider.getID(), HTML, SUBJECT_TIP + "DDD");
+ assertTrue(!testTip.equals(testTip2));
+ assertTrue(!testTip.equals(testTip2));
+
+ TestTip testTip3 = new TestTip(fProvider.getID(), HTML, SUBJECT_TIP + "DDD");
+ assertTrue(!testTip.equals(testTip3));
+ assertTrue(!testTip3.equals(testTip));
+
TestTip testTip4 = new TestTip(fProvider.getID(), HTML, SUBJECT_TIP + "DDD");
assertTrue(!testTip.equals(testTip4));
assertTrue(!testTip4.equals(testTip));
- TestTip testTip5 = new TestTip(fProvider.getID(),HTML, SUBJECT_TIP + "DDDWW");
+ TestTip testTip5 = new TestTip(fProvider.getID(), HTML, SUBJECT_TIP + "DDDWW");
assertTrue(!testTip.equals(testTip5));
assertTrue(!testTip5.equals(testTip));
- TestTip testTip6 = new TestTip(fProvider.getID(),HTML, null);
+ TestTip testTip6 = new TestTip(fProvider.getID(), HTML, null);
assertTrue(!testTip.equals(testTip6));
assertTrue(!testTip6.equals(testTip));
@@ -145,9 +154,9 @@ public class TipTest {
fManager.setAsRead(fTip);
assertTrue(fManager.isRead(fTip));
}
-
+
private void createTestDate() {
- fProvider.setTips(Arrays.asList(new TestTip(fProvider.getID(),"<b>bold</b>", "Tip 1"),
- new TestTip(fProvider.getID(),"<b>bold2</b>", "Tip 2")));
+ fProvider.setTips(Arrays.asList(new TestTip(fProvider.getID(), "<b>bold</b>", "Tip 1"),
+ new TestTip(fProvider.getID(), "<b>bold2</b>", "Tip 2")));
}
} \ No newline at end of file
diff --git a/org.eclipse.tips.tests/src/org/eclipse/tips/manual/tests/SleakTipManager.java b/org.eclipse.tips.tests/src/org/eclipse/tips/manual/tests/SleakTipManager.java
index 150ba8021..b3734a962 100644
--- a/org.eclipse.tips.tests/src/org/eclipse/tips/manual/tests/SleakTipManager.java
+++ b/org.eclipse.tips.tests/src/org/eclipse/tips/manual/tests/SleakTipManager.java
@@ -66,7 +66,7 @@ public class SleakTipManager extends TipManager {
shell.setLayout(new FillLayout());
new Sleak().open();
TipDialog tipDialog = new TipDialog(shell, SleakTipManager.this, TipDialog.DEFAULT_STYLE);
- tipDialog.addDisposeListener(pE -> dispose());
+ shell.addDisposeListener(pE -> dispose());
tipDialog.open();
shell.pack();
shell.open();

Back to the top