Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2018-07-18 15:51:29 -0400
committerAlexander Kurtakov2018-07-18 15:51:29 -0400
commit563234017ccf301340c4c3347034f76ba01b6331 (patch)
tree0972c662400091bfad1af4c63ec3c987e932a48f /org.eclipse.jface.text.tests
parent6e3a367007787031d82b4f744c03466d52bbef03 (diff)
downloadeclipse.platform.text-563234017ccf301340c4c3347034f76ba01b6331.tar.gz
eclipse.platform.text-563234017ccf301340c4c3347034f76ba01b6331.tar.xz
eclipse.platform.text-563234017ccf301340c4c3347034f76ba01b6331.zip
Use proper asserts and expected exceptions. Change-Id: Ic3bbc0a8221d40b57e4698f2ed40f0806daa3194 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
Diffstat (limited to 'org.eclipse.jface.text.tests')
-rw-r--r--org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TextViewerUndoManagerTest.java32
1 files changed, 12 insertions, 20 deletions
diff --git a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TextViewerUndoManagerTest.java b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TextViewerUndoManagerTest.java
index 6a55089c9..cda549491 100644
--- a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TextViewerUndoManagerTest.java
+++ b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TextViewerUndoManagerTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2008 IBM Corporation and others.
+ * Copyright (c) 2006, 2018 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
@@ -11,6 +11,8 @@
package org.eclipse.jface.text.tests;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import org.junit.Test;
@@ -27,7 +29,6 @@ import org.eclipse.core.runtime.Status;
import org.eclipse.text.undo.DocumentUndoEvent;
import org.eclipse.text.undo.DocumentUndoManager;
-import org.eclipse.text.undo.IDocumentUndoListener;
import org.eclipse.jface.text.Document;
import org.eclipse.jface.text.IDocument;
@@ -80,19 +81,14 @@ public class TextViewerUndoManagerTest extends AbstractUndoManagerTest {
Object newContext= new Object();
undoManager.connect(newContext);
- undoManager.addDocumentUndoListener(new IDocumentUndoListener() {
- @Override
- public void documentUndoNotification(DocumentUndoEvent event) {
- fail();
- }
- });
+ undoManager.addDocumentUndoListener(event -> fail());
undoManager.transferUndoHistory(tempUndoManager);
tempUndoManager.disconnect(context);
assertEquals(isUndoable, undoManager.undoable());
undoManager.undo();
- assertEquals(false, undoManager.undoable());
+ assertFalse(undoManager.undoable());
undoManager.disconnect(newContext);
}
@@ -114,22 +110,18 @@ public class TextViewerUndoManagerTest extends AbstractUndoManagerTest {
Object context= new Object();
undoManager.connect(context);
- undoManager.addDocumentUndoListener(new IDocumentUndoListener() {
-
- @Override
- public void documentUndoNotification(DocumentUndoEvent event) {
- if (event.getEventType() == DocumentUndoEvent.ABOUT_TO_UNDO)
- assertEquals(true, undoManager.undoable());
- else if (event.getEventType() == DocumentUndoEvent.UNDONE)
- assertEquals(false, undoManager.undoable());
- }
+ undoManager.addDocumentUndoListener(event -> {
+ if (event.getEventType() == DocumentUndoEvent.ABOUT_TO_UNDO)
+ assertTrue(undoManager.undoable());
+ else if (event.getEventType() == DocumentUndoEvent.UNDONE)
+ assertFalse(undoManager.undoable());
});
doc.set("foo");
- assertEquals(true, undoManager.undoable());
+ assertTrue(undoManager.undoable());
undoManager.undo();
- assertEquals(false, undoManager.undoable());
+ assertFalse(undoManager.undoable());
undoManager.disconnect(context);
}

Back to the top