SetCondition extends BasicCondition<T, SetCondition<T, E>> implements SetChecks<T, E, SetCondition<T, E>> { @Override public SetCondition<T, E> hasSizeGreaterThan(int minSizeExclusive) { require(this.subject).isNotNull(); if (!(this.subject.size() > minSizeExclusive)) { DbcAssertionError.throwNew(new IllegalStateException("Expected set size to be greater than <" + minSizeExclusive + "> but was <" + this.subject.size() + ">"), this.message); } return result(); } SetCondition(T subject); @Override SetCondition<T, E> isNotEmpty(); @Override SetCondition<T, E> hasSize(int size); @Override SetCondition<T, E> hasSizeBetween(int startInclusive, int endInclusive); @Override SetCondition<T, E> hasSizeGreaterThan(int minSizeExclusive); @Override SetCondition<T, E> hasSizeGreaterThanOrEqual(int minSize); @Override SetCondition<T, E> hasSizeLessThan(int maxSizeExclusive); @Override SetCondition<T, E> hasSizeLessThanOrEqual(int maxSize); @Override SetCondition<T, E> contains(E value);  }
@Test public void hasSizeGreaterThan() throws Exception { SetCondition<Set<String>, String> condition = new SetCondition<>(this.input); condition.hasSizeGreaterThan(2); SetCondition<Set<String>, String> badCondition = new SetCondition<>(this.input); Assertions.assertThatThrownBy(() -> badCondition.hasSizeGreaterThan(3)) .isInstanceOf(DbcAssertionError.class) .hasCauseInstanceOf(IllegalStateException.class); }