QoSHandler implements LoggableResource { protected boolean actionNecessary(Double ratio, double thresholdSentinelRatio) { return ratio != null && ratio <= thresholdSentinelRatio; } QoSHandler(final Vertx vertx, final ResourceStorage storage, final String qosSettingsPath, final Map<String, Object> properties, String prefix); @Override void enableResourceLogging(boolean resourceLoggingEnabled); boolean handle(final HttpServerRequest request); QoSSentinel getOldSentinel(String sentinelName);  }
@Test public void testActionDetermination() { QoSHandler qosHandler = new QoSHandler(vertx, storage, qosSettingsPath, new HashMap<>(), prefix); assertThat(qosHandler.actionNecessary(1.5, 1.6), is(Boolean.TRUE)); assertThat(qosHandler.actionNecessary(1.5, 1.5), is(Boolean.TRUE)); assertThat(qosHandler.actionNecessary(1.5, 2.0), is(Boolean.TRUE)); assertThat(qosHandler.actionNecessary(1.5, 1.45), is(Boolean.FALSE)); assertThat(qosHandler.actionNecessary(1.5, 1.3), is(Boolean.FALSE)); assertThat(qosHandler.actionNecessary(1.5, 1), is(Boolean.FALSE)); }