Fix property test random crash

This commit is contained in:
Clément Fournier
2018-02-20 01:24:02 +01:00
parent 1c9a4fd31c
commit 1c991dd79e
3 changed files with 8 additions and 4 deletions

View File

@ -35,16 +35,18 @@ public class FloatPropertyTest extends AbstractNumericPropertyDescriptorTester<F
@Override
protected Float createBadValue() {
return randomBool() ? randomFloat(MIN - SHIFT, MIN) : randomFloat(MAX, MAX + SHIFT);
return randomBool() ? randomFloat(MIN - SHIFT, MIN) : randomFloat(MAX + 1, MAX + SHIFT);
}
@Override
protected FloatProperty.FloatPBuilder singleBuilder() {
return FloatProperty.named("test").desc("foo")
.range(MIN, MAX).defaultValue(createValue()).uiOrder(1.0f);
}
@Override
protected FloatMultiProperty.FloatMultiPBuilder multiBuilder() {
return FloatMultiProperty.named("test").desc("foo")
.range(MIN, MAX).defaultValues(createValue(), createValue()).uiOrder(1.0f);

View File

@ -30,16 +30,18 @@ public class LongPropertyTest extends AbstractNumericPropertyDescriptorTester<Lo
@Override
protected Long createBadValue() {
return randomBool() ? randomLong(MIN - SHIFT, MIN) : randomLong(MAX, MAX + SHIFT);
return randomBool() ? randomLong(MIN - SHIFT, MIN) : randomLong(MAX + 1, MAX + SHIFT);
}
@Override
protected LongProperty.LongPBuilder singleBuilder() {
return LongProperty.named("test").desc("foo")
.range(MIN, MAX).defaultValue(createValue()).uiOrder(1.0f);
}
@Override
protected LongMultiProperty.LongMultiPBuilder multiBuilder() {
return LongMultiProperty.named("test").desc("foo")
.range(MIN, MAX).defaultValues(createValue(), createValue()).uiOrder(1.0f);

View File

@ -120,13 +120,13 @@ public class SimpleEnumeratedPropertyTest extends AbstractPropertyDescriptorTest
@Override
protected Foo createValue() {
return randomChoice(Foo.values());
return randomChoice(VALUES);
}
@Override
protected Foo createBadValue() {
return null; // not in the set of values
return Foo.IGNORED; // not in the set of values
}