@Test
public void readRequestMultiAttributes() {

    for (JmxReadRequest req : new JmxReadRequest[] {
        JmxRequestFactory.createGetRequest("read/java.lang:type=Memory/Heap!/Memory!/Usage,NonHeapMemoryUsage", procParams),
        JmxRequestFactory.createPostRequest(
                createMap("type", "read", "mbean", "java.lang:type=Memory",
                          "attribute",Arrays.asList("Heap/Memory/Usage","NonHeapMemoryUsage")),procParams)
    }) {
        assertTrue(req.isMultiAttributeMode());
        for (List list : new List[] { (List) req.toJSON().get("attribute"), req.getAttributeNames() }) {
            assertEquals(list.size(), 2);
            assertTrue(list.contains("Heap/Memory/Usage"));
            assertTrue(list.contains("NonHeapMemoryUsage"));
            assertTrue(req.toString().contains("attribute=["));
            try {
                req.getAttributeName();
                fail();
            } catch (IllegalStateException exp) {
                assertTrue(exp.getMessage().contains("getAttributeNames"));
            }
        }
    }
}