use of org.jeasy.random.EasyRandomParameters in project operatorfabric-core by opfab.
the class CardProcessServiceShould method instantiateRandomCardGenerator.
@NotNull
private EasyRandom instantiateRandomCardGenerator() {
LocalDate today = LocalDate.now();
LocalDate tomorrow = today.plus(1, ChronoUnit.DAYS);
LocalTime nine = LocalTime.of(9, 0);
LocalTime fifteen = LocalTime.of(17, 0);
EasyRandomParameters parameters = new EasyRandomParameters().seed(5467L).objectPoolSize(100).randomizationDepth(3).charset(forName("UTF-8")).timeRange(nine, fifteen).dateRange(today, tomorrow).stringLengthRange(5, 50).collectionSizeRange(1, 10).excludeField(named("data")).excludeField(named("parameters")).excludeField(named("timeSpans")).scanClasspathForConcreteTypes(true).overrideDefaultInitialization(false).ignoreRandomizationErrors(true);
return new EasyRandom(parameters);
}
use of org.jeasy.random.EasyRandomParameters in project mule-wsc-connector by mulesoft.
the class ConfigEqualsTestCase method testReliableMessagingNotEquals.
@Test
public void testReliableMessagingNotEquals() {
EasyRandomParameters parameters = new EasyRandomParameters();
parameters.collectionSizeRange(1, 3);
EasyRandom factory = new EasyRandom(parameters);
ReliableMessagingConfiguration reliableMessaging = factory.nextObject(ReliableMessagingConfiguration.class);
assertThat(reliableMessaging, is(notNullValue()));
assertThat(reliableMessaging, not(equalTo(new Object())));
}
use of org.jeasy.random.EasyRandomParameters in project mule-wsc-connector by mulesoft.
the class ConfigEqualsTestCase method testAddressingEquals.
@Test
public void testAddressingEquals() {
EasyRandomParameters parameters = new EasyRandomParameters();
parameters.collectionSizeRange(1, 3);
EasyRandom factory = new EasyRandom(parameters);
EasyRandom factory2 = new EasyRandom(parameters);
for (int i = 0; i < 1000; i++) {
AddressingConfiguration addressingConfiguration = factory.nextObject(AddressingConfiguration.class);
AddressingConfiguration clonedAddressingConfiguration = factory2.nextObject(AddressingConfiguration.class);
assertThat(addressingConfiguration, is(addressingConfiguration));
assertThat(clonedAddressingConfiguration, is(clonedAddressingConfiguration));
assertThat(addressingConfiguration, is(clonedAddressingConfiguration));
assertThat(addressingConfiguration.hashCode(), is(clonedAddressingConfiguration.hashCode()));
}
}
use of org.jeasy.random.EasyRandomParameters in project mule-wsc-connector by mulesoft.
the class ConfigEqualsTestCase method testAddressingNotEquals.
@Test
public void testAddressingNotEquals() {
EasyRandomParameters parameters = new EasyRandomParameters();
parameters.collectionSizeRange(1, 3);
EasyRandom factory = new EasyRandom(parameters);
AddressingConfiguration addressingConfiguration = factory.nextObject(AddressingConfiguration.class);
assertThat(addressingConfiguration, is(notNullValue()));
assertThat(addressingConfiguration, not(equalTo(new Object())));
}
use of org.jeasy.random.EasyRandomParameters in project mule-wsc-connector by mulesoft.
the class ConfigEqualsTestCase method testCustomTransportsEquals.
@Test
public void testCustomTransportsEquals() {
EasyRandomParameters parameters = new EasyRandomParameters();
parameters.collectionSizeRange(1, 3);
EasyRandom factory = new EasyRandom(parameters);
EasyRandom factory2 = new EasyRandom(parameters);
for (int i = 0; i < 1000; i++) {
CustomTransportConfiguration customTransport = factory.nextObject(CustomHttpTransportConfiguration.class);
CustomTransportConfiguration anotherCustomTransport = factory.nextObject(DefaultHttpTransportConfiguration.class);
CustomTransportConfiguration clonedCustomTransport = factory2.nextObject(CustomHttpTransportConfiguration.class);
CustomTransportConfiguration anotherClonedCustomTransport = factory2.nextObject(DefaultHttpTransportConfiguration.class);
assertThat(customTransport, is(clonedCustomTransport));
assertThat(customTransport.hashCode(), is(clonedCustomTransport.hashCode()));
assertThat(anotherCustomTransport, is(anotherClonedCustomTransport));
assertThat(anotherCustomTransport.hashCode(), is(anotherClonedCustomTransport.hashCode()));
assertThat(customTransport, not(anotherCustomTransport));
assertThat(customTransport.hashCode(), not(anotherCustomTransport.hashCode()));
assertThat(clonedCustomTransport, not(anotherClonedCustomTransport));
assertThat(clonedCustomTransport.hashCode(), not(anotherClonedCustomTransport.hashCode()));
}
}
Aggregations