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