mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-24 17:11:43 +01:00
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:
parent
470ce633cb
commit
92e32e68cf
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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());
|
Loading…
Reference in New Issue
Block a user