Skip to content

Commit d7988d0

Browse files
committed
make Tests more stable by using Before and AfterEach instead of class
1 parent e9215fa commit d7988d0

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

  • dbus-java/src/test/java/org/freedesktop/dbus/test

dbus-java/src/test/java/org/freedesktop/dbus/test/TestAll.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@
7676
import org.freedesktop.dbus.types.UInt32;
7777
import org.freedesktop.dbus.types.UInt64;
7878
import org.freedesktop.dbus.types.Variant;
79-
import org.junit.jupiter.api.AfterAll;
80-
import org.junit.jupiter.api.BeforeAll;
79+
import org.junit.jupiter.api.AfterEach;
80+
import org.junit.jupiter.api.BeforeEach;
8181
import org.junit.jupiter.api.Test;
8282

8383
import com.github.hypfvieh.util.TimeMeasure;
@@ -91,13 +91,13 @@ public class TestAll {
9191
public static final String TEST_OBJECT_PATH = "/TestAll";
9292

9393
// CHECKSTYLE:OFF
94-
private static DBusConnection serverconn = null;
95-
private static DBusConnection clientconn = null;
96-
private static SampleClass tclass;
94+
private DBusConnection serverconn = null;
95+
private DBusConnection clientconn = null;
96+
private SampleClass tclass;
9797
// CHECKSTYLE:ON
9898

99-
@BeforeAll
100-
public static void beforeClass() throws DBusException {
99+
@BeforeEach
100+
public void setUp() throws DBusException {
101101
serverconn = DBusConnection.getConnection(DBusBusType.SESSION);
102102
clientconn = DBusConnection.getConnection(DBusBusType.SESSION);
103103
serverconn.setWeakReferences(true);
@@ -111,8 +111,8 @@ public static void beforeClass() throws DBusException {
111111
serverconn.addFallback("/FallbackTest", tclass);
112112
}
113113

114-
@AfterAll
115-
public static void afterClass() {
114+
@AfterEach
115+
public void afterClass() {
116116
System.out.println("Checking for outstanding errors");
117117
DBusExecutionException dbee = serverconn.getError();
118118
if (null != dbee) {

0 commit comments

Comments
 (0)