blob: 13171ae5d2a176351920726011b2ef14c3744823 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
package tools.refinery.store.model.representation.cardinality;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.instanceOf;
class UpperCardinalitiesTest {
@ParameterizedTest
@ValueSource(ints = {0, 1, 255, 256, 1000, Integer.MAX_VALUE})
void valueOfBoundedTest(int value) {
var upperCardinality = UpperCardinalities.valueOf(value);
assertThat(upperCardinality, instanceOf(FiniteUpperCardinality.class));
assertThat(((FiniteUpperCardinality) upperCardinality).finiteUpperBound(), equalTo(value));
}
@Test
void valueOfUnboundedTest() {
var upperCardinality = UpperCardinalities.valueOf(-1);
assertThat(upperCardinality, instanceOf(UnboundedUpperCardinality.class));
}
}
|