@Test
@SuppressWarnings("unchecked")
public void decorateCanInvoke() throws Exception {

    BundleContext bc = setUpMocksForDecorate();
    RBACDecorator decorator = new RBACDecorator(bc);
    decorator.setVerify(true);
    Map<String, Object> result = readInput();
    LOG.info("In:  {}", result);
    decorator.decorate(result);
    LOG.info("Out: {}", result);
    Map<String, Map<String, Object>> domains = (Map<String, Map<String, Object>>) result.get("domains");
    Map<String, Object> domain = domains.get("org.apache.activemq");
    Map<String, Object> mbean = (Map<String, Object>) domain.get("type=Broker,brokerName=amq");
    assertThat(mbean.get("canInvoke"), equalTo(false));
    // op
    Map<String, Object> op = (Map<String, Object>) mbean.get("op");
    LOG.info("op = {}", op);
    assertThat(((Map<String, Object>) op.get("removeQueue")).get("canInvoke"), equalTo(false));
    assertThat(((Map<String, Object>) op.get("addQueue")).get("canInvoke"), equalTo(false));
    assertThat(((Map<String, Object>) op.get("stop")).get("canInvoke"), equalTo(true));
    assertThat(((Map<String, Object>) op.get("start")).get("canInvoke"), equalTo(true));
    assertThat(((List<Map<String, Object>>) op.get("overloadedMethod")).get(0).get("canInvoke"), equalTo(true));
    assertThat(((List<Map<String, Object>>) op.get("overloadedMethod")).get(1).get("canInvoke"), equalTo(false));
    assertThat(((List<Map<String, Object>>) op.get("overloadedMethod")).get(2).get("canInvoke"), equalTo(true));
    // opByString
    Map<String, Map<String, Boolean>> opByString = (Map<String, Map<String, Boolean>>) mbean.get("opByString");
    assertThat(opByString, notNullValue());
    LOG.info("opByString = {}", opByString);
    assertThat(opByString.keySet(), containsInAnyOrder(
        "removeQueue(java.lang.String)",
        "addQueue(java.lang.String)",
        "stop()",
        "start()",
        "overloadedMethod(java.lang.String)",
        "overloadedMethod(java.lang.String,java.lang.Object)",
        "overloadedMethod()"));
    assertThat(opByString.get("removeQueue(java.lang.String)").get("canInvoke"), equalTo(false));
    assertThat(opByString.get("addQueue(java.lang.String)").get("canInvoke"), equalTo(false));
    assertThat(opByString.get("stop()").get("canInvoke"), equalTo(true));
    assertThat(opByString.get("start()").get("canInvoke"), equalTo(true));
    assertThat(opByString.get("overloadedMethod(java.lang.String)").get("canInvoke"), equalTo(true));
    assertThat(opByString.get("overloadedMethod(java.lang.String,java.lang.Object)").get("canInvoke"), equalTo(false));
    assertThat(opByString.get("overloadedMethod()").get("canInvoke"), equalTo(true));
}