@Test public void testMetrics_sendConfirmation_OnceSuccessful_OnceUnsuccessful() { setNewMetrics(); boolean isSent = confirmationServiceImpl.sendConfirmation(confirmationInfoMock_sent); assertTrue("send confirmation should be successful", isSent); confirmationServiceImpl.sendConfirmation(confirmationInfoMock_notSent); double successRate = getSuccessRate(); assertEquals(0.5, successRate, 0); assertEquals(2, getAllSent()); assertEquals(1, getSentFailed()); }
@Override public boolean sendConfirmation(ConfirmationInfo confirmationInfo) { boolean delivered = false; try { delivered = confirmationDelegate.send(confirmationInfo); } catch (Exception e) { LOG.error("Could not send confirmation for: " + confirmationInfo); delivered = false; } finally { notifyMetrics(delivered); } return delivered; }
ConfirmationServiceImpl extends CoreBaseService<ConfirmationServiceMetric<ConfirmationServiceContext>, ConfirmationServiceContext> implements
        ConfirmationService { @Override public boolean sendConfirmation(ConfirmationInfo confirmationInfo) { boolean delivered = false; try { delivered = confirmationDelegate.send(confirmationInfo); } catch (Exception e) { LOG.error("Could not send confirmation for: " + confirmationInfo); delivered = false; } finally { notifyMetrics(delivered); } return delivered; } }
ConfirmationServiceImpl extends CoreBaseService<ConfirmationServiceMetric<ConfirmationServiceContext>, ConfirmationServiceContext> implements
        ConfirmationService { @Override public boolean sendConfirmation(ConfirmationInfo confirmationInfo) { boolean delivered = false; try { delivered = confirmationDelegate.send(confirmationInfo); } catch (Exception e) { LOG.error("Could not send confirmation for: " + confirmationInfo); delivered = false; } finally { notifyMetrics(delivered); } return delivered; }  }
ConfirmationServiceImpl extends CoreBaseService<ConfirmationServiceMetric<ConfirmationServiceContext>, ConfirmationServiceContext> implements
        ConfirmationService { @Override public boolean sendConfirmation(ConfirmationInfo confirmationInfo) { boolean delivered = false; try { delivered = confirmationDelegate.send(confirmationInfo); } catch (Exception e) { LOG.error("Could not send confirmation for: " + confirmationInfo); delivered = false; } finally { notifyMetrics(delivered); } return delivered; }  @Override boolean sendConfirmation(ConfirmationInfo confirmationInfo); @Override @Retryable boolean sendMessage(MailMessage message); }
ConfirmationServiceImpl extends CoreBaseService<ConfirmationServiceMetric<ConfirmationServiceContext>, ConfirmationServiceContext> implements
        ConfirmationService { @Override public boolean sendConfirmation(ConfirmationInfo confirmationInfo) { boolean delivered = false; try { delivered = confirmationDelegate.send(confirmationInfo); } catch (Exception e) { LOG.error("Could not send confirmation for: " + confirmationInfo); delivered = false; } finally { notifyMetrics(delivered); } return delivered; }  @Override boolean sendConfirmation(ConfirmationInfo confirmationInfo); @Override @Retryable boolean sendMessage(MailMessage message);  }