Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/java/net/andreinc/mockneat/unit/text/Strings.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public Strings(MockNeat mockNeat) {
}

public Strings size(int size) {
isTrue(size>0, SIZE_BIGGER_THAN_ZERO_STRICT);
isTrue(size>=0, SIZE_BIGGER_THAN_ZERO);
this.size = size;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ public final class ValidationUtils {
public static final String UPPER_BOUND_BIGGER_LOWER_BOUND = "The input parameter 'upperBound' > 'lowerBound'.";
public static final String UPPER_MONTH_BIGGER_THAN_LOWER = "'lower' Month < 'upper' Month";
public static final String IS_FINITE_NUMBER = "Number #{number} should be finite (non-infinite, non-nan).";
public static final String SIZE_BIGGER_THAN_ZERO_STRICT = "The size needs to be bigger than 0 (>).";
public static final String SIZE_BIGGER_THAN_ZERO = "The size needs to be bigger than 0 (>=).";
public static final String IN_RANGE_CLOSED = "Number: #{num} should be in [#{min}, #{max}] range.";
public static final String CANNOT_ADD_VALUE_TO_COLLECTION = "Cannot add value '#{val}' to collection '#{cls.simpleName}'";
Expand Down
12 changes: 12 additions & 0 deletions src/test/java/net/andreinc/mockneat/unit/text/StringsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@ public void testSizeNegative() {
M.strings().size(-10).val();
}

@Test
public void testSizeZero() {
loop(
1,
MOCKS,
(m) -> {
String empty = m.strings().size(0).val();
assertEquals(0, empty.length());
}
);
}

@Test
public void testVariableSizes() {
loop(
Expand Down