-
-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added some testcases for different config interfaces and config without
JMXBean interface.
- Loading branch information
1 parent
d16ca33
commit cc4cb52
Showing
2 changed files
with
166 additions
and
8 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
owner/src/test/java/org/aeonbits/owner/jmx/InvalidJMXBeanTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package org.aeonbits.owner.jmx; | ||
|
||
import java.lang.management.ManagementFactory; | ||
import java.util.Properties; | ||
|
||
import javax.management.InstanceAlreadyExistsException; | ||
import javax.management.MBeanRegistrationException; | ||
import javax.management.MBeanServer; | ||
import javax.management.MalformedObjectNameException; | ||
import javax.management.NotCompliantMBeanException; | ||
import javax.management.ObjectName; | ||
|
||
import org.aeonbits.owner.Config; | ||
import org.aeonbits.owner.ConfigFactory; | ||
import org.junit.Test; | ||
|
||
public class InvalidJMXBeanTest { | ||
|
||
private static interface ConfigNoJMX extends Config { | ||
@DefaultValue("1") | ||
int number(); | ||
} | ||
|
||
@Test(expected=NotCompliantMBeanException.class) | ||
public void testConfigWithoutJMXInterface() throws MalformedObjectNameException, InstanceAlreadyExistsException, MBeanRegistrationException, NotCompliantMBeanException{ | ||
Properties props = new Properties(); | ||
ConfigNoJMX config = ConfigFactory.create(ConfigNoJMX.class, props); | ||
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); | ||
ObjectName mbeanName = new ObjectName("org.aeonbits.owner.jmx:type=testConfigWithoutJMXInterface,id=ConfigNoJMX"); | ||
mbs.registerMBean(config, mbeanName); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters