Stop throwing error with empty text

Previous implementation of annotations allowed empty text,
so it is important to keep compatibility with the refactored
builder implementation.
This commit is contained in:
Risto Lahtela 2021-04-25 10:46:17 +03:00
parent 470ce633cb
commit 92e32e68cf
2 changed files with 3 additions and 12 deletions

View File

@ -41,7 +41,7 @@ public class ExtDataBuilder implements ExtensionDataBuilder {
@Override
public ValueBuilder valueBuilder(String text) {
if (text == null || text.isEmpty()) throw new IllegalArgumentException("'text' can't be null or empty");
if (text == null) throw new IllegalArgumentException("'text' can't be null");
return new ExtValueBuilder(text, extension);
}

View File

@ -25,25 +25,16 @@ import java.util.Collections;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
public class ExtendionDataBuilderTest {
public class ExtensionDataBuilderTest {
@Test
void nullTextWhenCreatingValueBuilderThrowsException() {
ExtDataBuilder builder = new ExtDataBuilder(new Extension());
assertEquals(
"'text' can't be null or empty",
"'text' can't be null",
assertThrows(IllegalArgumentException.class, () -> builder.valueBuilder(null)).getMessage()
);
}
@Test
void emptyTextWhenCreatingValueBuilderThrowsException() {
ExtDataBuilder builder = new ExtDataBuilder(new Extension());
assertEquals(
"'text' can't be null or empty",
assertThrows(IllegalArgumentException.class, () -> builder.valueBuilder("")).getMessage()
);
}
@Test
void nullClassSupplierNotAdded() {
ExtDataBuilder builder = new ExtDataBuilder(new Extension());