@Test public void metricPusherShouldDoNothingOnNull() { PushGatewayPusherCreator pushGatewayPusherCreator = new PushGatewayPusherCreator(); pushGatewayPusherCreator.create(() -> null).pushSafe(null, null, null); }
public MetricPusher create(String address) { Supplier<PushGateway> pushGatewaySupplier = () -> { try { return new PushGateway(address); } catch (Exception e) { logger.error("PushGateway creation failed.", e); return null; } }; return create(pushGatewaySupplier); }
PushGatewayPusherCreator implements MetricPusherCreator { public MetricPusher create(String address) { Supplier<PushGateway> pushGatewaySupplier = () -> { try { return new PushGateway(address); } catch (Exception e) { logger.error("PushGateway creation failed.", e); return null; } }; return create(pushGatewaySupplier); } }
PushGatewayPusherCreator implements MetricPusherCreator { public MetricPusher create(String address) { Supplier<PushGateway> pushGatewaySupplier = () -> { try { return new PushGateway(address); } catch (Exception e) { logger.error("PushGateway creation failed.", e); return null; } }; return create(pushGatewaySupplier); }  }
PushGatewayPusherCreator implements MetricPusherCreator { public MetricPusher create(String address) { Supplier<PushGateway> pushGatewaySupplier = () -> { try { return new PushGateway(address); } catch (Exception e) { logger.error("PushGateway creation failed.", e); return null; } }; return create(pushGatewaySupplier); }  MetricPusher create(String address); MetricPusher create(Supplier<PushGateway> pushGatewaySupplier); }
PushGatewayPusherCreator implements MetricPusherCreator { public MetricPusher create(String address) { Supplier<PushGateway> pushGatewaySupplier = () -> { try { return new PushGateway(address); } catch (Exception e) { logger.error("PushGateway creation failed.", e); return null; } }; return create(pushGatewaySupplier); }  MetricPusher create(String address); MetricPusher create(Supplier<PushGateway> pushGatewaySupplier);  }