Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions tests/org.eclipse.jface.tests/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ Require-Bundle: org.junit;bundle-version="4.12.0",
org.eclipse.core.runtime,
org.eclipse.ui,
org.eclipse.ui.tests.harness
Import-Package: org.osgi.framework,
org.junit.jupiter.api;version="[5.14.0,6.0.0)",
Import-Package: org.junit.jupiter.api;version="[5.14.0,6.0.0)",
org.junit.jupiter.api.function;version="[5.14.0,6.0.0)",
org.junit.platform.suite.api;version="[1.14.0,2.0.0)"
org.junit.platform.commons.function;version="[1.14.0,2.0.0)",
org.junit.platform.suite.api;version="[1.14.0,2.0.0)",
org.osgi.framework
Export-Package: org.eclipse.jface.tests.fieldassist;x-internal:=true,
org.eclipse.jface.tests.preferences;x-internal:=true,
org.eclipse.jface.tests.viewers;x-internal:=true
Expand Down
2 changes: 2 additions & 0 deletions tests/org.eclipse.jface.text.tests/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,6 @@ Import-Package: org.mockito,
org.mockito.invocation,
org.mockito.stubbing,
org.junit.jupiter.api;version="[5.14.0,6.0.0)",
org.junit.jupiter.params;version="[5.14.0,6.0.0)",
org.junit.jupiter.params.provider;version="[5.14.0,6.0.0)",
org.junit.platform.suite.api;version="[1.14.0,2.0.0)"
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
*******************************************************************************/
package org.eclipse.jface.text.tests;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;

import org.junit.Test;
import org.junit.jupiter.api.Test;

import org.eclipse.jface.text.DefaultTextDoubleClickStrategy;
import org.eclipse.jface.text.Document;
Expand Down Expand Up @@ -48,11 +48,11 @@ public void testClickAtLineEnd() throws Exception {
IDocument document= new Document(content);
TestSpecificDefaultTextDoubleClickStrategy doubleClickStrategy= new TestSpecificDefaultTextDoubleClickStrategy();
IRegion selection= doubleClickStrategy.findWord(document, 11);
assertNotNull("Should have selected a word", selection);
assertEquals("Unexpected selection", "world", document.get(selection.getOffset(), selection.getLength()));
assertNotNull(selection, "Should have selected a word");
assertEquals("world", document.get(selection.getOffset(), selection.getLength()), "Unexpected selection");
selection= doubleClickStrategy.findWord(document, document.getLength());
assertNotNull("Should have selected a word", selection);
assertEquals("Unexpected selection", "you", document.get(selection.getOffset(), selection.getLength()));
assertNotNull(selection, "Should have selected a word");
assertEquals("you", document.get(selection.getOffset(), selection.getLength()), "Unexpected selection");
}

private static final class TestSpecificDefaultTextDoubleClickStrategy extends DefaultTextDoubleClickStrategy {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
*******************************************************************************/
package org.eclipse.jface.text.tests;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;

import org.junit.Test;
import org.junit.jupiter.api.Test;

import org.eclipse.jface.fieldassist.IContentProposal;

Expand All @@ -31,8 +31,8 @@ private void assertProposal(IContentProposal[] proposals, String prefix, String
break;
}
}
assertNotNull("No proposal for " + prefix + " found", match);
assertEquals("Unexpected replacement", replacement, match.getContent());
assertNotNull(match, "No proposal for " + prefix + " found");
assertEquals(replacement, match.getContent(), "Unexpected replacement");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@
*******************************************************************************/
package org.eclipse.jface.text.tests;

import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;

import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionListener;
Expand Down Expand Up @@ -165,7 +165,7 @@ public void testBackspace() throws MalformedTreeException {
}

@Test
@Ignore(value = "this is currently for manual testing")
@Disabled("this is currently for manual testing")
public void testViewer() {
Shell shell= new Shell();
Button b = new Button(shell, SWT.PUSH);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
*******************************************************************************/
package org.eclipse.jface.text.tests;

import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;

import org.junit.Test;
import org.junit.jupiter.api.Test;

import org.eclipse.swt.SWT;
import org.eclipse.swt.dnd.Clipboard;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
*******************************************************************************/
package org.eclipse.jface.text.tests;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.anyString;
Expand All @@ -26,9 +26,9 @@
import java.util.Arrays;
import java.util.List;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;

Expand All @@ -55,14 +55,14 @@ public class TestWhitespaceCharacterPainter {

private Shell shell;

@Before
@BeforeEach
public void before() {
shell= new Shell();
shell.setSize(500, 200);
shell.setLayout(new FillLayout());
}

@After
@AfterEach
public void after() {
shell.dispose();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
*******************************************************************************/
package org.eclipse.jface.text.tests.codemining;

import static org.junit.Assert.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals;

import java.util.Arrays;

import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyledText;
Expand Down Expand Up @@ -46,7 +46,7 @@ public class CodeMiningLineHeaderAnnotationTest {

private Document document;

@Before
@BeforeEach
public void setUp() {
fShell= new Shell(Display.getDefault());
fShell.setSize(500, 200);
Expand All @@ -58,7 +58,7 @@ public void setUp() {
fViewer.setDocument(document, new AnnotationModel());
final Display display= textWidget.getDisplay();
fShell.open();
Assert.assertTrue(new DisplayHelper() {
Assertions.assertTrue(new DisplayHelper() {
@Override
protected boolean condition() {
return fViewer.getTextWidget().isVisible();
Expand All @@ -67,7 +67,7 @@ protected boolean condition() {
DisplayHelper.sleep(textWidget.getDisplay(), 1000);
}

@After
@AfterEach
public void tearDown() {
fViewer= null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*/
package org.eclipse.jface.text.tests.codemining;

import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.util.ArrayList;
import java.util.Arrays;
Expand All @@ -22,10 +22,10 @@
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.atomic.AtomicReference;

import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.osgi.framework.Bundle;

import org.eclipse.swt.SWT;
Expand Down Expand Up @@ -90,7 +90,7 @@ public void dispose() {
private Shell fParent;
private ProjectionViewer fViewer;

@Before
@BeforeEach
public void setUp() {
Shell[] shells= Display.getDefault().getShells();
for (Shell shell : shells) {
Expand All @@ -112,7 +112,7 @@ public void setUp() {
fViewer.doOperation(ProjectionViewer.TOGGLE);
}

@After
@AfterEach
public void tearDown() {
fParent.dispose();
}
Expand All @@ -137,7 +137,7 @@ protected Shell findNewShell(Collection<Shell> beforeShells) {
DisplayHelper.sleep(fParent.getDisplay(), 1000);
}
afterShells= findNewShells(beforeShells);
assertTrue("No new shell found, existing: " + beforeShells, afterShells.size() > beforeShells.size());
assertTrue(afterShells.size() > beforeShells.size(), "No new shell found, existing: " + beforeShells);
return afterShells.get(0);
}

Expand Down Expand Up @@ -166,7 +166,7 @@ public void testCollapse() throws Exception {
try {
// without workbench, next line throws Exception directly
DisplayHelper.sleep(fParent.getDisplay(), 1000);
Assert.assertNull(logError.get());
Assertions.assertNull(logError.get());
} finally {
if (log != null) {
log.removeLogListener(logListener);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@
*******************************************************************************/
package org.eclipse.jface.text.tests.contentassist;

import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.Assume.assumeFalse;

import java.util.Arrays;
import java.util.Collection;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
Expand Down Expand Up @@ -58,7 +58,7 @@ public class AsyncContentAssistTest {

private Shell shell;

@Before
@BeforeEach
public void setUp() {
shell= new Shell();
listener= (status, plugin) -> {
Expand All @@ -69,7 +69,7 @@ public void setUp() {
Platform.addLogListener(listener);
}

@After
@AfterEach
public void tearDown() {
shell.dispose();
Platform.removeLogListener(listener);
Expand Down Expand Up @@ -123,13 +123,13 @@ public void testCompletePrefix() {
final Collection<Shell> beforeShells= AbstractContentAssistTest.getCurrentShells();
contentAssistant.showPossibleCompletions();
Shell newShell= AbstractContentAssistTest.findNewShell(beforeShells);
assertTrue("Completion item not shown", new DisplayHelper() {
assertTrue(new DisplayHelper() {
@Override
protected boolean condition() {
Table completionTable= findCompletionSelectionControl(newShell);
return Arrays.stream(completionTable.getItems()).map(TableItem::getText).anyMatch(item -> item.contains(BarContentAssistProcessor.PROPOSAL.substring(document.getLength())));
}
}.waitForCondition(display, 2000));
}.waitForCondition(display, 2000), "Completion item not shown");
}

@Test
Expand Down Expand Up @@ -164,13 +164,13 @@ public void testCompleteActivationChar() {
final Collection<Shell> beforeShells= AbstractContentAssistTest.getCurrentShells();
AbstractContentAssistTest.processEvents();
Shell newShell= AbstractContentAssistTest.findNewShell(beforeShells);
assertTrue("Completion item not shown", new DisplayHelper() {
assertTrue(new DisplayHelper() {
@Override
protected boolean condition() {
Table completionTable= findCompletionSelectionControl(newShell);
return Arrays.stream(completionTable.getItems()).map(TableItem::getText).anyMatch(item -> item.contains(BarContentAssistProcessor.PROPOSAL.substring(document.getLength())));
}
}.waitForCondition(display, 4000));
}.waitForCondition(display, 4000), "Completion item not shown");
}

private static Table findCompletionSelectionControl(Widget control) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
package org.eclipse.jface.text.tests.contentassist;

import static java.util.Collections.singletonList;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.lang.reflect.Field;
import java.util.ArrayList;
Expand All @@ -22,10 +22,10 @@
import java.util.concurrent.CountDownLatch;
import java.util.function.Predicate;

import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
Expand Down Expand Up @@ -64,7 +64,7 @@ public class FilteringAsyncContentAssistTests {
private SourceViewer viewer;
private ContentAssistant ca;

@Before
@BeforeEach
public void setup() {
tearDown();

Expand All @@ -79,7 +79,7 @@ public void setup() {
ca = new ContentAssistant(true);
}

@After
@AfterEach
public void tearDown() {
if (shell != null) {
ca.uninstall();
Expand Down Expand Up @@ -288,7 +288,8 @@ public void testCA_WithFirstDelayedThenImmediateProposals() throws Exception {
*
* @throws Exception exception
*/
@Test @Ignore
@Test
@Disabled("Bug: filtering only applied after all CA processors have completed")
public void testFastCompletionsNotFilteredUntilLongComplitionsCalculated() throws Exception {
IDocument document = viewer.getDocument();

Expand Down
Loading
Loading