コード例 #1
0
 @Test
 public void testCopyCalls() throws Exception {
   ApnsPooledConnection conn = new ApnsPooledConnection(prototype, 1, getSingleThreadExecutor());
   for (int i = 0; i < 10; i++) {
     conn.sendMessage(mock(ApnsNotification.class));
   }
   verify(prototype, times(1)).copy();
 }
コード例 #2
0
 @Test
 public void testCloseCalls() throws Exception {
   ApnsPooledConnection conn = new ApnsPooledConnection(prototype, 1, getSingleThreadExecutor());
   conn.sendMessage(mock(ApnsNotification.class));
   conn.close();
   // should be closed twice because of the thread local copy
   verify(prototype, times(2)).close();
 }
コード例 #3
0
 @Test(expected = NetworkIOException.class)
 public void testSendMessage() throws Exception {
   ApnsPooledConnection conn =
       new ApnsPooledConnection(errorPrototype, 1, getSingleThreadExecutor());
   conn.sendMessage(mock(ApnsNotification.class));
 }