mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-09-30 15:37:50 +02: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
|
@Override
|
||||||
public ValueBuilder valueBuilder(String text) {
|
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);
|
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.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||||
|
|
||||||
public class ExtendionDataBuilderTest {
|
public class ExtensionDataBuilderTest {
|
||||||
@Test
|
@Test
|
||||||
void nullTextWhenCreatingValueBuilderThrowsException() {
|
void nullTextWhenCreatingValueBuilderThrowsException() {
|
||||||
ExtDataBuilder builder = new ExtDataBuilder(new Extension());
|
ExtDataBuilder builder = new ExtDataBuilder(new Extension());
|
||||||
assertEquals(
|
assertEquals(
|
||||||
"'text' can't be null or empty",
|
"'text' can't be null",
|
||||||
assertThrows(IllegalArgumentException.class, () -> builder.valueBuilder(null)).getMessage()
|
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
|
@Test
|
||||||
void nullClassSupplierNotAdded() {
|
void nullClassSupplierNotAdded() {
|
||||||
ExtDataBuilder builder = new ExtDataBuilder(new Extension());
|
ExtDataBuilder builder = new ExtDataBuilder(new Extension());
|
Loading…
Reference in New Issue
Block a user