MapCondition extends BasicCondition<T, MapCondition<T, K, V>> implements MapChecks<T, K, V, MapCondition<T, K, V>> { @Override public MapCondition<T, K, V> isNotEmpty() { require(this.subject).isNotNull(); if (this.subject.isEmpty()) { DbcAssertionError.throwNew(new IllegalArgumentException("Expected non empty map"), this.message); } return result(); } MapCondition(T subject); @Override MapCondition<T, K, V> isNotEmpty(); @Override MapCondition<T, K, V> hasSize(int size); @Override MapCondition<T, K, V> hasSizeBetween(int startInclusive, int endInclusive); @Override MapCondition<T, K, V> containsKey(K key); @Override MapCondition<T, K, V> containsValue(V value); @Override MapCondition<T, K, V> hasSizeGreaterThan(int minSizeExclusive); @Override MapCondition<T, K, V> hasSizeGreaterThanOrEqual(int minSize); @Override MapCondition<T, K, V> hasSizeLessThan(int maxSizeExclusive); @Override MapCondition<T, K, V> hasSizeLessThanOrEqual(int maxSize);  }
@Test public void isNotEmpty() throws Exception { MapCondition<Map<String, String>, String, String> condition = new MapCondition<>(this.input); condition.isNotEmpty(); MapCondition<Map<String, String>, String, String> badCondition = new MapCondition<>(new LinkedHashMap<>()); Assertions.assertThatThrownBy(badCondition::isNotEmpty) .isInstanceOf(DbcAssertionError.class) .hasCauseInstanceOf(IllegalArgumentException.class); }