예제 #1
0
 @Test
 public void init() throws InterruptedException {
   mDNSSDEmbedded.init();
   PowerMockito.verifyStatic();
   DNSSDEmbedded.Init();
   PowerMockito.verifyStatic(timeout(TIMEOUT));
   DNSSDEmbedded.Loop();
 }
예제 #2
0
 @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();
 }
예제 #3
0
 @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();
 }
예제 #4
0
 @Test
 public void exit() throws InterruptedException {
   mDNSSDEmbedded.exit();
   PowerMockito.verifyStatic(timeout(2 * TIMEOUT));
   DNSSDEmbedded.Exit();
 }