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
4 changes: 2 additions & 2 deletions tests/org.eclipse.ui.tests.forms/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ Bundle-Version: 3.10.600.qualifier
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.test.performance,
org.eclipse.ui.forms,
org.junit
org.eclipse.ui.forms
Bundle-Vendor: Eclipse.org
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)"
Bundle-RequiredExecutionEnvironment: JavaSE-17
Eclipse-BundleShape: dir
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
package org.eclipse.ui.tests.forms;

import org.eclipse.ui.tests.forms.performance.FormsPerformanceTest;

import org.junit.platform.suite.api.SelectClasses;
import org.junit.platform.suite.api.Suite;


/*
* Tests forms performance (automated).
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
import org.eclipse.ui.tests.forms.layout.AllLayoutTests;
import org.eclipse.ui.tests.forms.util.AllUtilityTests;
import org.eclipse.ui.tests.forms.widgets.AllWidgetsTests;

import org.junit.platform.suite.api.SelectClasses;
import org.junit.platform.suite.api.Suite;


/**
* Tests all forms functionality (automated).
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.eclipse.ui.tests.forms.events;

import org.junit.platform.suite.api.Suite;
import org.junit.platform.suite.api.SelectClasses;
import org.junit.platform.suite.api.Suite;

@Suite
@SelectClasses({ ExpansionListenerTest.class, //
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package org.eclipse.ui.tests.forms.events;

import static org.junit.Assert.assertEquals;

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

import java.util.function.Consumer;

Expand All @@ -9,10 +11,10 @@
import org.eclipse.ui.forms.events.ExpansionEvent;
import org.eclipse.ui.forms.events.IExpansionListener;
import org.eclipse.ui.forms.widgets.Section;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

public class ExpansionListenerTest {

Expand All @@ -22,19 +24,19 @@ public class ExpansionListenerTest {
private static Shell shell;
private static Section section;

@BeforeClass
@BeforeAll
public static void classSetup() {
shell = new Shell();
section = new Section(shell, SWT.NONE);
}

@Before
@BeforeEach
public void setup() {
firedEvent = new ExpansionEvent(section, true);
expansionEventConsumer = event -> this.catchedEvent = event;
}

@AfterClass
@AfterAll
public static void classTeardown() {
shell.dispose();
}
Expand All @@ -50,14 +52,13 @@ public void callsExpansionStateChangingConsumer() {
IExpansionListener.expansionStateChangingAdapter(expansionEventConsumer).expansionStateChanging(firedEvent);
assertEquals(firedEvent, catchedEvent);
}

@Test(expected = NullPointerException.class)
public void throwsNullPointerOnNullStateChangedAdapter() {
IExpansionListener.expansionStateChangedAdapter(null);
@Test
void throwsNullPointerOnNullStateChangedAdapter() {
assertThrows(NullPointerException.class, () -> IExpansionListener.expansionStateChangedAdapter(null));
}

@Test(expected = NullPointerException.class)
public void throwsNullPointerOnNullStateChangingAdapter() {
IExpansionListener.expansionStateChangingAdapter(null);
@Test
void throwsNullPointerOnNullStateChangingAdapter() {
assertThrows(NullPointerException.class, () -> IExpansionListener.expansionStateChangingAdapter(null));
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package org.eclipse.ui.tests.forms.events;

import static org.junit.Assert.assertEquals;

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

import java.util.function.Consumer;

Expand All @@ -9,10 +11,10 @@
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.forms.events.HyperlinkEvent;
import org.eclipse.ui.forms.events.IHyperlinkListener;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

public class HyperLinkListenerTest {

Expand All @@ -22,19 +24,19 @@ public class HyperLinkListenerTest {
private Consumer<HyperlinkEvent> linkEventConsumer;
private static Link link;

@BeforeClass
@BeforeAll
public static void classSetup() {
shell = new Shell();
link = new Link(shell, SWT.NONE);
}

@Before
@BeforeEach
public void setup() {
firedEvent = new HyperlinkEvent(link, "uri://test", "link", 0);
linkEventConsumer = event -> this.catchedEvent = event;
}

@AfterClass
@AfterAll
public static void classTeardown() {
shell.dispose();
}
Expand All @@ -57,18 +59,19 @@ public void callsEnteredConsumer() {
assertEquals(firedEvent, catchedEvent);
}

@Test(expected = NullPointerException.class)
@Test
public void throwsNullPointerOnNullActivatedAdapter() {
IHyperlinkListener.linkActivatedAdapter(null);
assertThrows(NullPointerException.class, () -> IHyperlinkListener.linkActivatedAdapter(null));
}

@Test(expected = NullPointerException.class)
@Test
public void throwsNullPointerOnNullExitedAdapter() {
IHyperlinkListener.linkExitedAdapter(null);
assertThrows(NullPointerException.class, () -> IHyperlinkListener.linkExitedAdapter(null));
}

@Test(expected = NullPointerException.class)
@Test
public void throwsNullPointerOnNullEnteredAdapter() {
IHyperlinkListener.linkEnteredAdapter(null);
assertThrows(NullPointerException.class, () -> IHyperlinkListener.linkEnteredAdapter(null));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@

import org.eclipse.ui.tests.forms.widgets.HintAdjustmentTest;
import org.eclipse.ui.tests.forms.widgets.SizeCacheTest;

import org.junit.platform.suite.api.SelectClasses;
import org.junit.platform.suite.api.Suite;


/**
* Test all form layouts
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@

package org.eclipse.ui.tests.forms.layout;

import static org.junit.Assert.assertEquals;

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

import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Point;
Expand All @@ -29,9 +30,9 @@
import org.eclipse.ui.forms.widgets.ColumnLayoutData;
import org.eclipse.ui.internal.forms.widgets.ColumnLayoutUtils;
import org.eclipse.ui.tests.forms.layout.ControlFactory.TestLayout;
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;

public class TestColumnWrapLayout {

Expand All @@ -46,7 +47,7 @@ public class TestColumnWrapLayout {
private Composite inner;
private ColumnLayout layout;

@Before
@BeforeEach
public void setUp() {
display = PlatformUI.getWorkbench().getDisplay();
shell = new Shell(display);
Expand All @@ -62,7 +63,7 @@ public void setUp() {
inner.setLayout(layout);
}

@After
@AfterEach
public void tearDown() {
shell.dispose();
}
Expand Down Expand Up @@ -348,7 +349,7 @@ private void assertAllChildrenHaveWidth(int desiredWidth) {
Control next = children[idx];

Rectangle bounds = next.getBounds();
assertEquals("Child " + idx + " should have the correct width", desiredWidth, bounds.width);
assertEquals(desiredWidth, bounds.width, "Child " + idx + " should have the correct width");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@

package org.eclipse.ui.tests.forms.layout;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

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

import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Point;
Expand All @@ -30,9 +31,9 @@
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.forms.widgets.TableWrapData;
import org.eclipse.ui.forms.widgets.TableWrapLayout;
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;

public class TestTableWrapLayout {

Expand All @@ -47,7 +48,7 @@ private int rightEdge(Control lab) {
return r.x + r.width;
}

@Before
@BeforeEach
public void setUp() {
display = PlatformUI.getWorkbench().getDisplay();
shell = new Shell(display);
Expand All @@ -64,7 +65,7 @@ public void setUp() {
inner.setLayout(layout);
}

@After
@AfterEach
public void tearDown() {
shell.dispose();
}
Expand Down Expand Up @@ -135,8 +136,8 @@ public void testTableWrapLayoutWrappingLabels() {
inner.setSize(300, 1000);
inner.layout(false);

assertEquals("l1 had the wrong bounds", new Rectangle(0, 0, 300, 10), l1.getBounds());
assertEquals("l2 had the wrong bounds", new Rectangle(0, 10, 300, 40), l2.getBounds());
assertEquals(new Rectangle(0, 0, 300, 10), l1.getBounds(), "l1 had the wrong bounds");
assertEquals(new Rectangle(0, 10, 300, 40), l2.getBounds(), "l2 had the wrong bounds");
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
import org.eclipse.ui.forms.widgets.Section;
import org.eclipse.ui.forms.widgets.TableWrapData;
import org.eclipse.ui.forms.widgets.TableWrapLayout;
import org.junit.Test;
import org.junit.jupiter.api.Test;

public class FormsPerformanceTest extends PerformanceTestCase {

Expand Down
Loading
Loading