@Test public void primitiveShorts() throws Exception { assertThat(testResult(PrimitiveShorts.class), isSuccessful()); assertEquals(defaultPropertyTrialCount(), PrimitiveShorts.iterations); assertEquals( new HashSet<>(asList(Short.valueOf("9"), Short.valueOf("8"))), new HashSet<>(PrimitiveShorts.values.subList(0, 2))); }
@Test public void primitiveShorts() throws Exception { assertThat(testResult(PrimitiveShorts.class), isSuccessful()); assertEquals(2, PrimitiveShorts.iterations); assertEquals( new HashSet<>(asList(Short.valueOf("9"), Short.valueOf("8"))), PrimitiveShorts.testCases); }
@Test public void primitiveBytes() throws Exception { assertThat(testResult(PrimitiveBytes.class), isSuccessful()); assertEquals(2, PrimitiveBytes.iterations); assertEquals( new HashSet<>(asList(Byte.valueOf("12"), Byte.valueOf("-13"))), PrimitiveBytes.testCases); }
@Test public void wrapperBytes() throws Exception { assertThat(testResult(WrapperBytes.class), isSuccessful()); assertEquals(2, WrapperBytes.iterations); assertEquals( new HashSet<>(asList(Byte.valueOf("14"), Byte.valueOf("-15"))), WrapperBytes.testCases); }
@Test public void primitiveDoubles() throws Exception { assertThat(testResult(PrimitiveDoubles.class), isSuccessful()); assertEquals(defaultPropertyTrialCount(), PrimitiveDoubles.iterations); assertEquals( new HashSet<>(asList(3.2, -4D)), new HashSet<>(PrimitiveDoubles.values.subList(0, 2))); }
@Test public void wrapperDoubles() throws Exception { assertThat(testResult(WrapperDoubles.class), isSuccessful()); assertEquals(defaultPropertyTrialCount(), WrapperDoubles.iterations); assertEquals( new HashSet<>(asList(2.7, -3.14)), new HashSet<>(WrapperDoubles.values.subList(0, 2))); }
@Test public void wrapperFloats() throws Exception { assertThat(testResult(WrapperFloats.class), isSuccessful()); assertEquals(defaultPropertyTrialCount(), WrapperFloats.iterations); assertEquals( new HashSet<>(asList(1.7F, -4.14F)), new HashSet<>(WrapperFloats.values.subList(0, 2))); }
@Test public void autoGenerationWithAggregateAnnotationsOnTypeUsesInConstructors() { assertThat( testResult(WithAutoGenerationWithAggregateAnnotationsOnTypeUsesInConstructors.class), isSuccessful()); }
@Test public void twoGenericParametersReferringToSameType() { assertThat( testResult(TwoGenericParametersReferringToSameType.class), isSuccessful()); }
@Test public void wrapperBooleans() throws Exception { assertThat(testResult(WrapperBooleans.class), isSuccessful()); assertEquals(defaultPropertyTrialCount(), WrapperBooleans.iterations); assertEquals(false, WrapperBooleans.values.get(0)); assertEquals( new HashSet<>(asList(true, false)), new HashSet<>(WrapperBooleans.values)); }
@Test public void primitiveChars() throws Exception { assertThat(testResult(PrimitiveChars.class), isSuccessful()); assertEquals(2, PrimitiveChars.iterations); assertEquals( new HashSet<>(asList('Z', 'z')), PrimitiveChars.testCases); }
@Test public void wrapperFloats() throws Exception { assertThat(testResult(WrapperFloats.class), isSuccessful()); assertEquals(2, WrapperFloats.iterations); assertEquals( new HashSet<>(asList(1.7F, -4.14F)), WrapperFloats.testCases); }
@Test public void primitiveIntegers() throws Exception { assertThat(testResult(PrimitiveIntegers.class), isSuccessful()); assertEquals(3, PrimitiveIntegers.iterations); assertEquals( new HashSet<>(asList(1, 2, 3)), PrimitiveIntegers.testCases); }
@Test public void strings() throws Exception { assertThat(testResult(Strings.class), isSuccessful()); assertEquals(2, Strings.iterations); assertEquals( new HashSet<>(asList("some", "values")), Strings.testCases); }
@Test public void enums() throws Exception { assertThat(testResult(Enums.class), isSuccessful()); assertEquals(defaultPropertyTrialCount(), Enums.iterations); assertEquals( EnumSet.of(HALF_UP, HALF_EVEN), new HashSet<>(Enums.values.subList(0, 2))); }
@Test public void whenConstrained() throws Exception { assertThat(testResult(EnumWithConstraint.class), isSuccessful()); assertEquals(defaultPropertyTrialCount(), EnumWithConstraint.values.size()); assertThat(EnumWithConstraint.values, not(hasItem(E3))); }
@Test public void parameterConfiguredButGenericParameterNotConfigured() { assertThat( testResult(ParameterConfiguredButGenericParameterNotConfigured.class), isSuccessful()); }
@Test public void enums() throws Exception { assertThat(testResult(Enums.class), isSuccessful()); assertEquals(2, Enums.iterations); assertEquals(EnumSet.of(HALF_UP, HALF_EVEN), Enums.testCases); }
@Test public void expectedOrderingOfMethods() throws Exception { assertThat(testResult(Leaf.class), isSuccessful()); assertEquals( resourceAsString("trait-property-test-expected.txt"), bytesOut.toString()); }
@Test public void shouldNotCallOnFailingSetHookIfTestSucceeds() { assumeThat(testResult(SuccessfulTest.class), isSuccessful()); assertEquals(0, StoreFailingSetInGlobalVariable.counter); assertNull(StoreFailingSetInGlobalVariable.counterexample); }