    @Test
    public void testMerge() throws Exception {

//        MetadataSharing mds = Mockito.mock(MetadataSharing.class);
//
//        PowerMockito.mockStatic(MetadataSharing.class);
//        when(MetadataSharing.getInstance()).thenReturn(mds);

        PowerMockito.mockStatic(Handler.class, new Answer() {
            @Override
            public Object answer(InvocationOnMock invocation) throws Throwable {
                return null;
            }
        });

        Privilege p1 = buildPrivilege("Privilege 1", "A privilege");
        Privilege p2 = buildPrivilege("Privilege 2", "A privilege");
        Privilege p3 = buildPrivilege("Privilege 3", "A privilege");
        Privilege p4 = buildPrivilege("Privilege 4", "A privilege");

        Role existing = new Role();
        existing.addPrivilege(p2);
        existing.addPrivilege(p3);

        Role incoming = new Role();
        incoming.addPrivilege(p1);
        incoming.addPrivilege(p2);
        incoming.addPrivilege(p3);
        incoming.addPrivilege(p4);

        Map<Object, Object> incomingToExisting = new HashMap<Object, Object>();
        incomingToExisting.put(p1, p1);
        incomingToExisting.put(p2, p2);
        incomingToExisting.put(p3, p3);
        incomingToExisting.put(p4, p4);

        ObjectHandler objectHandler = new ObjectHandler(new OpenmrsObjectVisitor(), new ComparisonEngine());
        objectHandler.merge(existing, incoming, ImportType.OVERWRITE_MINE, incomingToExisting);

        assertThat(existing.getPrivileges().size(), is(4));
        assertThat(existing.getPrivileges(), containsInAnyOrder(p1, p2, p3, p4));
    }