@Test public void init() throws InterruptedException { mDNSSDEmbedded.init(); PowerMockito.verifyStatic(); DNSSDEmbedded.Init(); PowerMockito.verifyStatic(timeout(TIMEOUT)); DNSSDEmbedded.Loop(); }
@Test public void initWithError() throws InterruptedException { PowerMockito.when(DNSSDEmbedded.Init()).thenReturn(-1); mDNSSDEmbedded.init(); PowerMockito.verifyStatic(); DNSSDEmbedded.Init(); PowerMockito.verifyStatic(after(TIMEOUT).never()); DNSSDEmbedded.Loop(); }
@Test public void cancelStopTimer() throws InterruptedException { mDNSSDEmbedded.init(); PowerMockito.verifyStatic(); DNSSDEmbedded.Init(); PowerMockito.verifyStatic(timeout(TIMEOUT)); DNSSDEmbedded.Loop(); mDNSSDEmbedded.exit(); Thread.sleep(TIMEOUT / 2); mDNSSDEmbedded.init(); Thread.sleep(TIMEOUT / 2); PowerMockito.verifyStatic(never()); DNSSDEmbedded.Exit(); mDNSSDEmbedded.exit(); PowerMockito.verifyStatic(timeout(2 * TIMEOUT)); DNSSDEmbedded.Exit(); }
@Test public void exit() throws InterruptedException { mDNSSDEmbedded.exit(); PowerMockito.verifyStatic(timeout(2 * TIMEOUT)); DNSSDEmbedded.Exit(); }