Skip to content

Commit bafe65b

Browse files
Diagnose JUnit Test
1 parent 17f4e59 commit bafe65b

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

contrib/platform/test/com/sun/jna/platform/linux/UdevTest.java

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,29 +74,32 @@ public void testEnumerateDevices() {
7474
// No additional reference is acquired from getParent
7575
if (parent != null && parent2 != null) {
7676
// Devnode should match same parent without restricting to block and disk
77-
assertEquals("Partition parent should match with and without filter",
77+
assertEquals(String.format(
78+
"Partition parent should match with and without filter (%s)",
79+
devnode
80+
),
7881
parent.getDevnode(), parent2.getDevnode());
7982
// Save the size and major
8083
parentSize = parent.getSysattrValue("size");
8184
parentMajor = parent.getPropertyValue("MAJOR");
8285
}
8386
}
8487
String size = device.getSysattrValue("size");
85-
assertTrue("Size must be nonnegative", 0 <= Long.parseLong(size));
88+
assertTrue(String.format("Size must be nonnegative (%s)", devnode), 0 <= Long.parseLong(size));
8689
if (parentSize != null) {
87-
assertTrue("Partition can't be bigger than its disk",
90+
assertTrue(String.format("Partition can't be bigger than its disk (%s)", devnode),
8891
Long.parseLong(size) <= Long.parseLong(parentSize));
8992
}
9093
String major = device.getPropertyValue("MAJOR");
91-
assertTrue("Major value must be nonnegative", 0 <= Long.parseLong(major));
94+
assertTrue(String.format("Major value must be nonnegative (%s)", devnode), 0 <= Long.parseLong(major));
9295
if (parentMajor != null) {
93-
assertEquals("Partition and its parent disk should have same major number", major,
96+
assertEquals(String.format("Partition and its parent disk should have same major number (%s)", devnode), major,
9497
parentMajor);
9598
}
96-
assertEquals("DevType mismatch", devType, device.getDevtype());
97-
assertEquals("Subsystem mismatch", "block", device.getSubsystem());
98-
assertEquals("Syspath mismatch", syspath, device.getSyspath());
99-
assertTrue("Syspath should end with name", syspath.endsWith(device.getSysname()));
99+
assertEquals(String.format("DevType mismatch (%s)", devnode), devType, device.getDevtype());
100+
assertEquals(String.format("Subsystem mismatch (%s)", devnode), "block", device.getSubsystem());
101+
assertEquals(String.format("Syspath mismatch (%s)", devnode), syspath, device.getSyspath());
102+
assertTrue(String.format("Syspath should end with name (%s)", devnode), syspath.endsWith(device.getSysname()));
100103
}
101104
} finally {
102105
// Release the reference and iterate to the next device

0 commit comments

Comments
 (0)