@Test public void isExceededShouldReturnFalseWhenOnThreshold() { assertThat(_75.isExceeded(Sizes._75_PERCENT)) .isFalse(); }
public boolean isExceeded(Quota<?, ?> quota) { if (quota.getLimit().isUnlimited()) { return false; } double used = toDouble(quota.getUsed().asLong()); double limit = toDouble(quota.getLimit().asLong()); double ratio = (used / limit); return ratio > quotaOccupationRatio; }
QuotaThreshold implements Comparable<QuotaThreshold> { public boolean isExceeded(Quota<?, ?> quota) { if (quota.getLimit().isUnlimited()) { return false; } double used = toDouble(quota.getUsed().asLong()); double limit = toDouble(quota.getLimit().asLong()); double ratio = (used / limit); return ratio > quotaOccupationRatio; } }
QuotaThreshold implements Comparable<QuotaThreshold> { public boolean isExceeded(Quota<?, ?> quota) { if (quota.getLimit().isUnlimited()) { return false; } double used = toDouble(quota.getUsed().asLong()); double limit = toDouble(quota.getLimit().asLong()); double ratio = (used / limit); return ratio > quotaOccupationRatio; } QuotaThreshold(double quotaOccupationRatio); }
QuotaThreshold implements Comparable<QuotaThreshold> { public boolean isExceeded(Quota<?, ?> quota) { if (quota.getLimit().isUnlimited()) { return false; } double used = toDouble(quota.getUsed().asLong()); double limit = toDouble(quota.getLimit().asLong()); double ratio = (used / limit); return ratio > quotaOccupationRatio; } QuotaThreshold(double quotaOccupationRatio); double getQuotaOccupationRatio(); int getQuotaOccupationRatioAsPercent(); boolean isExceeded(Quota<?, ?> quota); Optional<QuotaThreshold> nonZero(); @Override int compareTo(QuotaThreshold o); @Override final boolean equals(Object o); @Override final int hashCode(); @Override String toString(); }
QuotaThreshold implements Comparable<QuotaThreshold> { public boolean isExceeded(Quota<?, ?> quota) { if (quota.getLimit().isUnlimited()) { return false; } double used = toDouble(quota.getUsed().asLong()); double limit = toDouble(quota.getLimit().asLong()); double ratio = (used / limit); return ratio > quotaOccupationRatio; } QuotaThreshold(double quotaOccupationRatio); double getQuotaOccupationRatio(); int getQuotaOccupationRatioAsPercent(); boolean isExceeded(Quota<?, ?> quota); Optional<QuotaThreshold> nonZero(); @Override int compareTo(QuotaThreshold o); @Override final boolean equals(Object o); @Override final int hashCode(); @Override String toString(); static final QuotaThreshold ZERO; }