public static boolean isUnderDeviceRootNode(ResourceId path) {
        int rootIdx = ResourceIds.startsWithRootNode(path) ? 0 : -1;
        return path.nodeKeys().size() >= rootIdx + 3 &&
                DEVICE_SCHEMA.equals(path.nodeKeys().get(rootIdx + DEVICE_INDEX).schemaId()) &&
                (path.nodeKeys().get(rootIdx + DEVICE_INDEX) instanceof ListKey) &&
                DEVICES_SCHEMA.equals(path.nodeKeys().get(rootIdx + DEVICES_INDEX).schemaId());    }
@Test
    public void testDeviceSubtreeEventTest() {
        // root relative ResourceId used by DynamicConfigEvent
        ResourceId evtDevice = ResourceId.builder()
                    .addBranchPointSchema(DEVICES_NAME, DCS_NAMESPACE)
                    .addBranchPointSchema(DEVICE_NAME, DCS_NAMESPACE)
                    .addKeyLeaf(DEVICE_ID_KL_NAME, DCS_NAMESPACE, DID_A.toString())
                    .build();

        NodeKey<?> deviceKey = evtDevice.nodeKeys().get(1);
        assertThat(deviceKey, is(instanceOf(ListKey.class)));
        assertThat(deviceKey.schemaId().namespace(), is(equalTo(DCS_NAMESPACE)));
        assertThat(deviceKey.schemaId().name(), is(equalTo(DEVICE_NAME)));
        assertTrue(DeviceResourceIds.isUnderDeviceRootNode(evtDevice));
    }