@Test public void testRecordEventThrowsWasabiClientException() throws Exception { mockStatic(LoggerFactory.class); given(event.getName()).willReturn(Event.Name.valueOf("ASSIGNMENT")); given(event.getType()).willReturn(Event.Type.IMPRESSION); given(assignment.getUserID()).willReturn(User.ID.valueOf("user-a")); Bucket.Label bucketLabel = Bucket.Label.valueOf("red"); given(assignment.getBucketLabel()).willReturn(bucketLabel); Experiment.ID experimentID = Experiment.ID.valueOf("27ec196b-e90d-4752-9baf-5c3f11d9f78a"); given(assignment.getExperimentID()).willReturn(experimentID); WasabiClientException jce = new ApplicationNotFoundException(""); given(getLogger(any(Class.class))).willReturn(logger); logger.warn(any(String.class)); BDDMockito.willThrow(jce).given(transaction). insert(any(String.class), any(String.class), any(Experiment.ID.class), any(Bucket.Label.class), any(String.class), any(Date.class), any(String.class)); eventsEnvelope.run(); verify(event, times(1)).getName(); verify(assignment, times(1)).getBucketLabel(); verify(transaction, times(1)).insert(any(String.class), any(String.class), any(Experiment.ID.class), any(Bucket.Label.class), any(String.class), any(Date.class), any(String.class)); verify(logger, times(1)).warn(any(String.class)); }
@Override public void run() { try { recordEvent(assignment, event); } catch (Exception e) { if (e instanceof WasabiClientException) { logger.warn("unable to process event, cause: {}, message: {}", e.getCause(), ((WasabiClientException) e).getDetailMessage()); } } }
EventsEnvelope implements Runnable { @Override public void run() { try { recordEvent(assignment, event); } catch (Exception e) { if (e instanceof WasabiClientException) { logger.warn("unable to process event, cause: {}, message: {}", e.getCause(), ((WasabiClientException) e).getDetailMessage()); } } } }
EventsEnvelope implements Runnable { @Override public void run() { try { recordEvent(assignment, event); } catch (Exception e) { if (e instanceof WasabiClientException) { logger.warn("unable to process event, cause: {}, message: {}", e.getCause(), ((WasabiClientException) e).getDetailMessage()); } } } EventsEnvelope(final Assignment assignment, final Event event, final Transaction transaction); }
EventsEnvelope implements Runnable { @Override public void run() { try { recordEvent(assignment, event); } catch (Exception e) { if (e instanceof WasabiClientException) { logger.warn("unable to process event, cause: {}, message: {}", e.getCause(), ((WasabiClientException) e).getDetailMessage()); } } } EventsEnvelope(final Assignment assignment, final Event event, final Transaction transaction); @Override void run(); }
EventsEnvelope implements Runnable { @Override public void run() { try { recordEvent(assignment, event); } catch (Exception e) { if (e instanceof WasabiClientException) { logger.warn("unable to process event, cause: {}, message: {}", e.getCause(), ((WasabiClientException) e).getDetailMessage()); } } } EventsEnvelope(final Assignment assignment, final Event event, final Transaction transaction); @Override void run();  }