@Test
public void testExecuteNetconfTemplateThrowsIllegalStateException() throws Exception {

    AbstractNetconfRequest request = mock(AbstractNetconfRequest.class);
    try {
        m_cm.executeWithSession(createDirectDevice("1"), session -> {
            try {
                return session.sendRpc(request);
            } catch (NetconfMessageBuilderException e) {
                fail("un expected exception" + e.getMessage());
            }
            return null;
        });
        fail("Expected an IllegalStateException here");
    } catch (IllegalStateException e) {
        assertEquals("Device not connected : 1", e.getMessage());
    }
}