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/src/org/eclipse/tips
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/src/org/eclipse/tips')
-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
5 files changed, 30 insertions, 22 deletions
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