@Test
void testTakeLeadershipNvaMonitorException() throws Exception {

    ZookeeperConfiguration zookeeperConfiguration =
        new ZookeeperConfiguration("connection-string", "/leader-selector-path", null, null);
    List<MonitorConfiguration> monitors = new ArrayList<>();
    monitors.add(
        new MonitorConfiguration(
            "com.microsoft.azure.practices.nvadaemon.NvaMonitorTest$InvalidMonitor",
            null));
    DaemonConfiguration daemonConfiguration = new DaemonConfiguration(monitors, null);
    NvaDaemonConfiguration nvaDaemonConfiguration = new NvaDaemonConfiguration(
        zookeeperConfiguration, daemonConfiguration);
    CuratorFramework curatorFramework = mock(CuratorFramework.class);
    NvaLeaderSelectorListenerAdapter nvaLeaderSelectorListenerAdapter =
        new NvaLeaderSelectorListenerAdapter(nvaDaemonConfiguration, curatorFramework);
    Assertions.assertThrows(NvaMonitor.NvaMonitorException.class,
        () -> nvaLeaderSelectorListenerAdapter.takeLeadership(curatorFramework));
}