Skip to content

Commit

Permalink
test update/simplification
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinjwalls committed Jan 16, 2025
1 parent 7b85bfb commit 3fb85cd
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions test/jdk/javax/management/mxbean/SameObjectTwoNamesTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
public class SameObjectTwoNamesTest {

public static void main(String[] args) throws Exception {
boolean expectException = true;
try {
ObjectName objectName1 = new ObjectName("test:index=1");
ObjectName objectName2 = new ObjectName("test:index=2");
Expand All @@ -51,19 +50,10 @@ public static void main(String[] args) throws Exception {

mbs.registerMBean(mxBeanObject, objectName2);

if (expectException) {
throw new Exception("TEST FAILED: " +
"InstanceAlreadyExistsException was not thrown");
} else
System.out.println("Correctly got no exception with compat property");
throw new Exception("TEST FAILED: InstanceAlreadyExistsException was not thrown");
} catch (InstanceAlreadyExistsException e) {
if (expectException) {
System.out.println("Got expected InstanceAlreadyExistsException:");
e.printStackTrace(System.out);
} else {
throw new Exception(
"TEST FAILED: Got exception even though compat property set", e);
}
System.out.println("Got expected InstanceAlreadyExistsException:");
e.printStackTrace(System.out);
}
System.out.println("TEST PASSED");
}
Expand Down

0 comments on commit 3fb85cd

Please sign in to comment.