Polish MBeanClientInterceptorTests and recover two lost tests
Two test methods were missing the @Test annotation after the migration from JUnit 3 to JUnit 4.
This commit is contained in:
@@ -90,14 +90,14 @@ class MBeanClientInterceptorTests extends AbstractMBeanServerTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testProxyClassIsDifferent() throws Exception {
|
void proxyClassIsDifferent() throws Exception {
|
||||||
assumeTrue(runTests);
|
assumeTrue(runTests);
|
||||||
IJmxTestBean proxy = getProxy();
|
IJmxTestBean proxy = getProxy();
|
||||||
assertThat(proxy.getClass()).as("The proxy class should be different than the base class").isNotSameAs(IJmxTestBean.class);
|
assertThat(proxy.getClass()).as("The proxy class should be different than the base class").isNotSameAs(IJmxTestBean.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testDifferentProxiesSameClass() throws Exception {
|
void differentProxiesSameClass() throws Exception {
|
||||||
assumeTrue(runTests);
|
assumeTrue(runTests);
|
||||||
IJmxTestBean proxy1 = getProxy();
|
IJmxTestBean proxy1 = getProxy();
|
||||||
IJmxTestBean proxy2 = getProxy();
|
IJmxTestBean proxy2 = getProxy();
|
||||||
@@ -107,7 +107,7 @@ class MBeanClientInterceptorTests extends AbstractMBeanServerTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testGetAttributeValue() throws Exception {
|
void getAttributeValue() throws Exception {
|
||||||
assumeTrue(runTests);
|
assumeTrue(runTests);
|
||||||
IJmxTestBean proxy1 = getProxy();
|
IJmxTestBean proxy1 = getProxy();
|
||||||
int age = proxy1.getAge();
|
int age = proxy1.getAge();
|
||||||
@@ -115,7 +115,7 @@ class MBeanClientInterceptorTests extends AbstractMBeanServerTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testSetAttributeValue() throws Exception {
|
void setAttributeValue() throws Exception {
|
||||||
assumeTrue(runTests);
|
assumeTrue(runTests);
|
||||||
IJmxTestBean proxy = getProxy();
|
IJmxTestBean proxy = getProxy();
|
||||||
proxy.setName("Rob Harrop");
|
proxy.setName("Rob Harrop");
|
||||||
@@ -123,39 +123,35 @@ class MBeanClientInterceptorTests extends AbstractMBeanServerTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testSetAttributeValueWithRuntimeException() throws Exception {
|
void setAttributeValueWithRuntimeException() throws Exception {
|
||||||
assumeTrue(runTests);
|
assumeTrue(runTests);
|
||||||
IJmxTestBean proxy = getProxy();
|
IJmxTestBean proxy = getProxy();
|
||||||
assertThatIllegalArgumentException().isThrownBy(() ->
|
assertThatIllegalArgumentException().isThrownBy(() -> proxy.setName("Juergen"));
|
||||||
proxy.setName("Juergen"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testSetAttributeValueWithCheckedException() throws Exception {
|
void setAttributeValueWithCheckedException() throws Exception {
|
||||||
assumeTrue(runTests);
|
assumeTrue(runTests);
|
||||||
IJmxTestBean proxy = getProxy();
|
IJmxTestBean proxy = getProxy();
|
||||||
assertThatExceptionOfType(ClassNotFoundException.class).isThrownBy(() ->
|
assertThatExceptionOfType(ClassNotFoundException.class).isThrownBy(() -> proxy.setName("Juergen Class"));
|
||||||
proxy.setName("Juergen Class"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testSetAttributeValueWithIOException() throws Exception {
|
void setAttributeValueWithIOException() throws Exception {
|
||||||
assumeTrue(runTests);
|
assumeTrue(runTests);
|
||||||
IJmxTestBean proxy = getProxy();
|
IJmxTestBean proxy = getProxy();
|
||||||
assertThatIOException().isThrownBy(() ->
|
assertThatIOException().isThrownBy(() -> proxy.setName("Juergen IO"));
|
||||||
proxy.setName("Juergen IO"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testSetReadOnlyAttribute() throws Exception {
|
void setReadOnlyAttribute() throws Exception {
|
||||||
assumeTrue(runTests);
|
assumeTrue(runTests);
|
||||||
IJmxTestBean proxy = getProxy();
|
IJmxTestBean proxy = getProxy();
|
||||||
assertThatExceptionOfType(InvalidInvocationException.class).isThrownBy(() ->
|
assertThatExceptionOfType(InvalidInvocationException.class).isThrownBy(() -> proxy.setAge(900));
|
||||||
proxy.setAge(900));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testInvokeNoArgs() throws Exception {
|
void invokeNoArgs() throws Exception {
|
||||||
assumeTrue(runTests);
|
assumeTrue(runTests);
|
||||||
IJmxTestBean proxy = getProxy();
|
IJmxTestBean proxy = getProxy();
|
||||||
long result = proxy.myOperation();
|
long result = proxy.myOperation();
|
||||||
@@ -163,7 +159,7 @@ class MBeanClientInterceptorTests extends AbstractMBeanServerTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testInvokeArgs() throws Exception {
|
void invokeArgs() throws Exception {
|
||||||
assumeTrue(runTests);
|
assumeTrue(runTests);
|
||||||
IJmxTestBean proxy = getProxy();
|
IJmxTestBean proxy = getProxy();
|
||||||
int result = proxy.add(1, 2);
|
int result = proxy.add(1, 2);
|
||||||
@@ -171,15 +167,14 @@ class MBeanClientInterceptorTests extends AbstractMBeanServerTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testInvokeUnexposedMethodWithException() throws Exception {
|
void invokeUnexposedMethodWithException() throws Exception {
|
||||||
assumeTrue(runTests);
|
assumeTrue(runTests);
|
||||||
IJmxTestBean bean = getProxy();
|
IJmxTestBean bean = getProxy();
|
||||||
assertThatExceptionOfType(InvalidInvocationException.class).isThrownBy(() ->
|
assertThatExceptionOfType(InvalidInvocationException.class).isThrownBy(() -> bean.dontExposeMe());
|
||||||
bean.dontExposeMe());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testTestLazyConnectionToRemote() throws Exception {
|
void lazyConnectionToRemote() throws Exception {
|
||||||
assumeTrue(runTests);
|
assumeTrue(runTests);
|
||||||
|
|
||||||
final int port = SocketUtils.findAvailableTcpPort();
|
final int port = SocketUtils.findAvailableTcpPort();
|
||||||
@@ -217,7 +212,8 @@ class MBeanClientInterceptorTests extends AbstractMBeanServerTests {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testMXBeanAttributeAccess() throws Exception {
|
@Test
|
||||||
|
void mxBeanAttributeAccess() throws Exception {
|
||||||
MBeanClientInterceptor interceptor = new MBeanClientInterceptor();
|
MBeanClientInterceptor interceptor = new MBeanClientInterceptor();
|
||||||
interceptor.setServer(ManagementFactory.getPlatformMBeanServer());
|
interceptor.setServer(ManagementFactory.getPlatformMBeanServer());
|
||||||
interceptor.setObjectName("java.lang:type=Memory");
|
interceptor.setObjectName("java.lang:type=Memory");
|
||||||
@@ -226,7 +222,8 @@ class MBeanClientInterceptorTests extends AbstractMBeanServerTests {
|
|||||||
assertThat(proxy.getHeapMemoryUsage().getMax()).isGreaterThan(0);
|
assertThat(proxy.getHeapMemoryUsage().getMax()).isGreaterThan(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testMXBeanOperationAccess() throws Exception {
|
@Test
|
||||||
|
void mxBeanOperationAccess() throws Exception {
|
||||||
MBeanClientInterceptor interceptor = new MBeanClientInterceptor();
|
MBeanClientInterceptor interceptor = new MBeanClientInterceptor();
|
||||||
interceptor.setServer(ManagementFactory.getPlatformMBeanServer());
|
interceptor.setServer(ManagementFactory.getPlatformMBeanServer());
|
||||||
interceptor.setObjectName("java.lang:type=Threading");
|
interceptor.setObjectName("java.lang:type=Threading");
|
||||||
@@ -270,12 +267,10 @@ class MBeanClientInterceptorTests extends AbstractMBeanServerTests {
|
|||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
protected void populateAttributeDescriptor(Descriptor descriptor, Method getter, Method setter) {
|
protected void populateAttributeDescriptor(Descriptor descriptor, Method getter, Method setter) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
protected void populateOperationDescriptor(Descriptor descriptor, Method method) {
|
protected void populateOperationDescriptor(Descriptor descriptor, Method method) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "unused", "rawtypes" })
|
@SuppressWarnings({ "unused", "rawtypes" })
|
||||||
@@ -285,7 +280,6 @@ class MBeanClientInterceptorTests extends AbstractMBeanServerTests {
|
|||||||
|
|
||||||
@SuppressWarnings({ "unused", "rawtypes" })
|
@SuppressWarnings({ "unused", "rawtypes" })
|
||||||
protected void populateMBeanDescriptor(Descriptor mbeanDescriptor, String beanKey, Class beanClass) {
|
protected void populateMBeanDescriptor(Descriptor mbeanDescriptor, String beanKey, Class beanClass) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user