forked from phoedos/pmd
Fix property test random crash
This commit is contained in:
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user