Heartbeat implements Runnable { public Heartbeat(PAPPolicyEngine papEngine2) { papEngine = papEngine2; this.heartbeatInterval = Integer.parseInt(XACMLProperties.getProperty(XacmlRestProperties.PROP_PAP_HEARTBEAT_INTERVAL, "10000")); this.heartbeatTimeout = Integer.parseInt(XACMLProperties.getProperty(XacmlRestProperties.PROP_PAP_HEARTBEAT_TIMEOUT, "10000")); } Heartbeat(PAPPolicyEngine papEngine2); synchronized boolean isHeartBeatRunning(); synchronized void terminate(); @Override void run();  }
@Test public void testHeartbeat() throws IOException, PAPException { Heartbeat hb = new Heartbeat(null); assertThatThrownBy(hb::run).isInstanceOf(NullPointerException.class); assertTrue(hb.isHeartBeatRunning()); hb.terminate(); assertFalse(hb.isHeartBeatRunning()); }