@Test public void sendErrorEventOk() { TimeEncoding.setUp(); EventProducerFactory.setMockup(true); Queue<Event> eventQueue = EventProducerFactory.getMockupQueue(); EventCrashHandler crashHandler = new EventCrashHandler("unitTestInstance"); crashHandler.handleCrash("m1", "err1"); crashHandler.handleCrash("m1", "err2"); assertEquals(2, eventQueue.size()); }
@Override public synchronized void handleCrash(String type, String msg) { if (sendingError) { return; } try { sendingError = true; eventProducer.sendSevere(type, msg); } catch (Exception e) { e.printStackTrace(); } sendingError = false; }
EventCrashHandler implements CrashHandler { @Override public synchronized void handleCrash(String type, String msg) { if (sendingError) { return; } try { sendingError = true; eventProducer.sendSevere(type, msg); } catch (Exception e) { e.printStackTrace(); } sendingError = false; } }
EventCrashHandler implements CrashHandler { @Override public synchronized void handleCrash(String type, String msg) { if (sendingError) { return; } try { sendingError = true; eventProducer.sendSevere(type, msg); } catch (Exception e) { e.printStackTrace(); } sendingError = false; } EventCrashHandler(String instanceName); }
EventCrashHandler implements CrashHandler { @Override public synchronized void handleCrash(String type, String msg) { if (sendingError) { return; } try { sendingError = true; eventProducer.sendSevere(type, msg); } catch (Exception e) { e.printStackTrace(); } sendingError = false; } EventCrashHandler(String instanceName); @Override synchronized void handleCrash(String type, String msg); }
EventCrashHandler implements CrashHandler { @Override public synchronized void handleCrash(String type, String msg) { if (sendingError) { return; } try { sendingError = true; eventProducer.sendSevere(type, msg); } catch (Exception e) { e.printStackTrace(); } sendingError = false; } EventCrashHandler(String instanceName); @Override synchronized void handleCrash(String type, String msg);  }