• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java EnhancedRandom类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中io.github.benas.randombeans.api.EnhancedRandom的典型用法代码示例。如果您正苦于以下问题:Java EnhancedRandom类的具体用法?Java EnhancedRandom怎么用?Java EnhancedRandom使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



EnhancedRandom类属于io.github.benas.randombeans.api包,在下文中一共展示了EnhancedRandom类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: testToFailTask

import io.github.benas.randombeans.api.EnhancedRandom; //导入依赖的package包/类
@Test
public void testToFailTask() {
    manager.init();

    Pair<String, ExternalTaskFailureDto> pair = manager.toFailTask(null, new Object());
    Assert.assertNull(pair);

    pair = manager.toFailTask(Command.TASK_NAME, null);
    Assert.assertNull(pair);

    Command command = EnhancedRandom.random(Command.class);
    pair = manager.toFailTask(Command.TASK_NAME, command);

    Assert.assertNotNull(pair);
    Assert.assertNotNull(pair.getKey());
    Assert.assertEquals(command.getId(), pair.getKey());

    Assert.assertNotNull(pair.getValue());
    Assert.assertEquals(command.getWorkerId(), pair.getValue().getWorkerId());
    Assert.assertEquals(command.getErrorMessage(), pair.getValue().getErrorMessage());
    Assert.assertEquals(command.getRetries().intValue(), pair.getValue().getRetries());
    Assert.assertEquals(command.getRetryTimeout(), pair.getValue().getRetryTimeout());
}
 
开发者ID:EsikAntony,项目名称:camunda-task-dispatcher,代码行数:24,代码来源:ExternalTaskManagerImplTest.java


示例2: randomBeans

import io.github.benas.randombeans.api.EnhancedRandom; //导入依赖的package包/类
@Parameters
public static Iterable<MPD> randomBeans() {
    EnhancedRandom random = new MPDRandomBuilder()
            .constantStringField("segmentAlignment", "true")
            .constantStringField("subsegmentAlignment", "true")
            .constantStringField("lang", "sv")
            .constantStringField("contains", "1")
            .constantStringField("dependencyLevel", "1")
            .randomize(Long.class, (Supplier<Long>) () -> 5L)
            .randomize(PresentationType.class,(Supplier<PresentationType>) () ->
                    RANDOM.nextBoolean() ? PresentationType.STATIC : PresentationType.DYNAMIC)
            .randomize(Descriptor.class, new Supplier<Descriptor>() {
                private final EnhancedRandom random = new EnhancedRandomBuilder().build();
                @Override
                public Descriptor get() {
                    return random.nextObject(GenericDescriptor.class);
                }
            })
            .collectionSizeRange(1, 2)
            .seed(10005)
            .build();

    return () -> Stream.generate(() -> random.nextObject(MPD.class))
            .limit(10).iterator();
}
 
开发者ID:carlanton,项目名称:mpd-tools,代码行数:26,代码来源:RandomBeanTest.java


示例3: testRandomization

import io.github.benas.randombeans.api.EnhancedRandom; //导入依赖的package包/类
@Test
public void testRandomization() {
    logger.debug("Testing random object generation (seed="+seed+")...");

    // TODO In theory, giving the same id should generate the same result, not different ones.
    List<String> potentialClasses = JaxbHelper.getNonNIEMClassNames();
    if( potentialClasses == null || potentialClasses.size() == 0 ){
        Assert.fail("There are no classes which to generate randomly.");
    }
    Random random = new Random(System.currentTimeMillis());
    String className = potentialClasses.get(random.nextInt(potentialClasses.size()));
    logger.info("  Creating sample Class: "+className);
    try {
        Class clz = Class.forName(className);
        // TODO Figure out how to incorporate the seed here.
        Object instance = EnhancedRandom.random(clz);
        assertThat(instance, notNullValue());

        // TODO Any other assertions?

    }catch(Throwable t){
        logger.error("An unexpected error occurred.", t);
        Assert.fail("Unexpected error using randomizer: "+t.toString());
    }

}
 
开发者ID:jtmrice,项目名称:IEPD-Java-Bindings,代码行数:27,代码来源:TestXmlRandomizer.java


示例4: testCharset

import io.github.benas.randombeans.api.EnhancedRandom; //导入依赖的package包/类
@Test
public void testCharset() {
    // Given
    Charset charset = StandardCharsets.UTF_8;
    List<Character> letters = filterLetters(collectPrintableCharactersOf(charset));
    EnhancedRandom enhancedRandom = aNewEnhancedRandomBuilder().charset(charset).build();

    // When
    Person person = enhancedRandom.nextObject(Person.class);

    // Then
    char[] chars = person.getName().toCharArray();
    for (char c : chars) {
        assertThat(letters).contains(c);
    }
}
 
开发者ID:benas,项目名称:random-beans,代码行数:17,代码来源:CharsetParameterTests.java


示例5: testRandomizationDepth

import io.github.benas.randombeans.api.EnhancedRandom; //导入依赖的package包/类
@Test
public void testRandomizationDepth() {
    // Given
    EnhancedRandom enhancedRandom = aNewEnhancedRandomBuilder()
            .randomizationDepth(2)
            .build();

    // When
    Person person = enhancedRandom.nextObject(Person.class);

    // Then
    assertThat(person).isNotNull();
    assertThat(person.getParent()).isNotNull();
    assertThat(person.getParent().getParent()).isNotNull();
    assertThat(person.getParent().getParent().getParent()).isNull();
}
 
开发者ID:benas,项目名称:random-beans,代码行数:17,代码来源:RandomizationDepthParameterTests.java


示例6: generatedObjectShouldBeAlwaysTheSameForTheSameSeed

import io.github.benas.randombeans.api.EnhancedRandom; //导入依赖的package包/类
@Test
public void generatedObjectShouldBeAlwaysTheSameForTheSameSeed() {
    // Given
    EnhancedRandom enhancedRandom = aNewEnhancedRandomBuilder().seed(SEED).build();

    String expectedString = "eOMtThyhVNLWUZNRcBaQKxIy";
    Person expectedPerson = buildExpectedPerson();
    int[] expectedInts = buildExpectedInts();

    // When
    String actualString = enhancedRandom.nextObject(String.class);
    Person actualPerson = enhancedRandom.nextObject(Person.class);
    int[] actualInts = enhancedRandom.nextObject(int[].class);

    // Then
    assertThat(actualString).isEqualTo(expectedString);
    assertThat(actualPerson).isEqualTo(expectedPerson);
    assertThat(actualInts).isEqualTo(expectedInts);
}
 
开发者ID:benas,项目名称:random-beans,代码行数:20,代码来源:SeedParameterTests.java


示例7: testStringLengthRange

import io.github.benas.randombeans.api.EnhancedRandom; //导入依赖的package包/类
@Test
public void testStringLengthRange() {
    // Given
    int minStringLength = 3;
    int maxStringLength = 50;
    EnhancedRandom enhancedRandom = aNewEnhancedRandomBuilder()
            .stringLengthRange(minStringLength, maxStringLength)
            .build();

    // When
    Person person = enhancedRandom.nextObject(Person.class);

    // Then
    assertThat(person.getName().length()).isBetween(minStringLength, maxStringLength);
    assertThat(person.getEmail().length()).isBetween(minStringLength, maxStringLength);
    assertThat(person.getPhoneNumber().length()).isBetween(minStringLength, maxStringLength);
    assertThat(person.getAddress().getCity().length()).isBetween(minStringLength, maxStringLength);
    assertThat(person.getAddress().getCountry().length()).isBetween(minStringLength, maxStringLength);
    assertThat(person.getAddress().getZipCode().length()).isBetween(minStringLength, maxStringLength);
    assertThat(person.getAddress().getStreet().getName().length()).isBetween(minStringLength, maxStringLength);
}
 
开发者ID:benas,项目名称:random-beans,代码行数:22,代码来源:StringLengthRangeParameterTests.java


示例8: customRandomizerShouldBeRegisteredInAllBuiltInstances

import io.github.benas.randombeans.api.EnhancedRandom; //导入依赖的package包/类
@Test
public void customRandomizerShouldBeRegisteredInAllBuiltInstances() {
    enhancedRandomBuilder = aNewEnhancedRandomBuilder();

    FieldDefinition<?, ?> fieldDefinition = field().named("name").ofType(String.class).inClass(Human.class).get();
    enhancedRandomBuilder.randomize(fieldDefinition, randomizer);

    EnhancedRandom enhancedRandom = enhancedRandomBuilder.build();
    Human human = enhancedRandom.nextObject(Human.class);

    assertThat(human.getName()).isEqualTo(NAME);

    EnhancedRandom enhancedRandom2 = enhancedRandomBuilder.build();
    Human human2 = enhancedRandom2.nextObject(Human.class);

    assertThat(human2.getName()).isEqualTo(NAME);
}
 
开发者ID:benas,项目名称:random-beans,代码行数:18,代码来源:EnhancedRandomBuilderTest.java


示例9: customSupplierShouldBeRegisteredInAllBuiltInstances

import io.github.benas.randombeans.api.EnhancedRandom; //导入依赖的package包/类
@Test
public void customSupplierShouldBeRegisteredInAllBuiltInstances() {
    enhancedRandomBuilder = aNewEnhancedRandomBuilder();

    FieldDefinition<?, ?> fieldDefinition = field().named("name").ofType(String.class).inClass(Human.class).get();
    enhancedRandomBuilder.randomize(fieldDefinition, supplier);

    EnhancedRandom enhancedRandom = enhancedRandomBuilder.build();
    Human human = enhancedRandom.nextObject(Human.class);

    assertThat(human.getName()).isEqualTo(NAME);

    EnhancedRandom enhancedRandom2 = enhancedRandomBuilder.build();
    Human human2 = enhancedRandom2.nextObject(Human.class);

    assertThat(human2.getName()).isEqualTo(NAME);
}
 
开发者ID:benas,项目名称:random-beans,代码行数:18,代码来源:EnhancedRandomBuilderTest.java


示例10: rawCollectionInterfacesShouldBeEmpty

import io.github.benas.randombeans.api.EnhancedRandom; //导入依赖的package包/类
@Test
public void rawCollectionInterfacesShouldBeEmpty() {
    EnhancedRandom enhancedRandom = aNewEnhancedRandom();

    final CollectionBean collectionsBean = enhancedRandom.nextObject(CollectionBean.class);

    assertThat(collectionsBean).isNotNull();

    assertThat(collectionsBean.getCollection()).isEmpty();
    assertThat(collectionsBean.getSet()).isEmpty();
    assertThat(collectionsBean.getSortedSet()).isEmpty();
    assertThat(collectionsBean.getNavigableSet()).isEmpty();
    assertThat(collectionsBean.getList()).isEmpty();
    assertThat(collectionsBean.getQueue()).isEmpty();
    assertThat(collectionsBean.getBlockingQueue()).isEmpty();
    assertThat(collectionsBean.getTransferQueue()).isEmpty();
    assertThat(collectionsBean.getDeque()).isEmpty();
    assertThat(collectionsBean.getBlockingDeque()).isEmpty();
}
 
开发者ID:benas,项目名称:random-beans,代码行数:20,代码来源:CollectionPopulatorTest.java


示例11: unboundedWildCardTypedCollectionInterfacesShouldBeEmpty

import io.github.benas.randombeans.api.EnhancedRandom; //导入依赖的package包/类
@Test
public void unboundedWildCardTypedCollectionInterfacesShouldBeEmpty() {
    EnhancedRandom enhancedRandom = aNewEnhancedRandom();

    final WildCardCollectionBean collectionsBean = enhancedRandom.nextObject(WildCardCollectionBean.class);

    assertThat(collectionsBean).isNotNull();

    assertThat(collectionsBean.getUnboundedWildCardTypedCollection()).isEmpty();
    assertThat(collectionsBean.getUnboundedWildCardTypedSet()).isEmpty();
    assertThat(collectionsBean.getUnboundedWildCardTypedSortedSet()).isEmpty();
    assertThat(collectionsBean.getUnboundedWildCardTypedNavigableSet()).isEmpty();
    assertThat(collectionsBean.getUnboundedWildCardTypedList()).isEmpty();
    assertThat(collectionsBean.getUnboundedWildCardTypedQueue()).isEmpty();
    assertThat(collectionsBean.getUnboundedWildCardTypedBlockingQueue()).isEmpty();
    assertThat(collectionsBean.getUnboundedWildCardTypedTransferQueue()).isEmpty();
    assertThat(collectionsBean.getUnboundedWildCardTypedDeque()).isEmpty();
    assertThat(collectionsBean.getUnboundedWildCardTypedBlockingDeque()).isEmpty();
}
 
开发者ID:benas,项目名称:random-beans,代码行数:20,代码来源:CollectionPopulatorTest.java


示例12: boundedWildCardTypedCollectionInterfacesShouldBeEmpty

import io.github.benas.randombeans.api.EnhancedRandom; //导入依赖的package包/类
@Test
public void boundedWildCardTypedCollectionInterfacesShouldBeEmpty() {
    EnhancedRandom enhancedRandom = aNewEnhancedRandom();

    final WildCardCollectionBean collectionsBean = enhancedRandom.nextObject(WildCardCollectionBean.class);

    assertThat(collectionsBean).isNotNull();

    assertThat(collectionsBean.getBoundedWildCardTypedCollection()).isEmpty();
    assertThat(collectionsBean.getBoundedWildCardTypedSet()).isEmpty();
    assertThat(collectionsBean.getBoundedWildCardTypedSortedSet()).isEmpty();
    assertThat(collectionsBean.getBoundedWildCardTypedNavigableSet()).isEmpty();
    assertThat(collectionsBean.getBoundedWildCardTypedList()).isEmpty();
    assertThat(collectionsBean.getBoundedWildCardTypedQueue()).isEmpty();
    assertThat(collectionsBean.getBoundedWildCardTypedBlockingQueue()).isEmpty();
    assertThat(collectionsBean.getBoundedWildCardTypedTransferQueue()).isEmpty();
    assertThat(collectionsBean.getBoundedWildCardTypedDeque()).isEmpty();
    assertThat(collectionsBean.getBoundedWildCardTypedBlockingDeque()).isEmpty();
}
 
开发者ID:benas,项目名称:random-beans,代码行数:20,代码来源:CollectionPopulatorTest.java


示例13: typedCollectionInterfacesShouldNotBeEmpty

import io.github.benas.randombeans.api.EnhancedRandom; //导入依赖的package包/类
@Test
public void typedCollectionInterfacesShouldNotBeEmpty() {
    EnhancedRandom enhancedRandom = aNewEnhancedRandom();

    final CollectionBean collectionsBean = enhancedRandom.nextObject(CollectionBean.class);

    assertThat(collectionsBean).isNotNull();

    assertContainsOnlyNonEmptyPersons(collectionsBean.getTypedCollection());
    assertContainsOnlyNonEmptyPersons(collectionsBean.getTypedSet());
    assertContainsOnlyNonEmptyPersons(collectionsBean.getTypedSortedSet());
    assertContainsOnlyNonEmptyPersons(collectionsBean.getTypedNavigableSet());
    assertContainsOnlyNonEmptyPersons(collectionsBean.getTypedList());
    assertContainsOnlyNonEmptyPersons(collectionsBean.getTypedQueue());
    assertContainsOnlyNonEmptyPersons(collectionsBean.getTypedBlockingQueue());
    assertContainsOnlyNonEmptyPersons(collectionsBean.getTypedTransferQueue());
    assertContainsOnlyNonEmptyPersons(collectionsBean.getTypedDeque());
    assertContainsOnlyNonEmptyPersons(collectionsBean.getTypedBlockingDeque());
}
 
开发者ID:benas,项目名称:random-beans,代码行数:20,代码来源:CollectionPopulatorTest.java


示例14: rawCollectionClassesShouldBeEmpty

import io.github.benas.randombeans.api.EnhancedRandom; //导入依赖的package包/类
@Test
public void rawCollectionClassesShouldBeEmpty() {
    EnhancedRandom enhancedRandom = aNewEnhancedRandom();

    final CollectionBean collectionsBean = enhancedRandom.nextObject(CollectionBean.class);

    assertThat(collectionsBean).isNotNull();

    assertThat(collectionsBean.getArrayList()).isEmpty();
    assertThat(collectionsBean.getLinkedList()).isEmpty();
    assertThat(collectionsBean.getVector()).isEmpty();
    assertThat(collectionsBean.getStack()).isEmpty();
    assertThat(collectionsBean.getHashSet()).isEmpty();
    assertThat(collectionsBean.getLinkedHashSet()).isEmpty();
    assertThat(collectionsBean.getTreeSet()).isEmpty();
    assertThat(collectionsBean.getConcurrentSkipListSet()).isEmpty();
    assertThat(collectionsBean.getArrayBlockingQueue()).isEmpty();
    assertThat(collectionsBean.getLinkedBlockingQueue()).isEmpty();
    assertThat(collectionsBean.getConcurrentLinkedQueue()).isEmpty();
    assertThat(collectionsBean.getLinkedTransferQueue()).isEmpty();
    assertThat(collectionsBean.getPriorityQueue()).isEmpty();
    assertThat(collectionsBean.getPriorityBlockingQueue()).isEmpty();
    assertThat(collectionsBean.getArrayDeque()).isEmpty();
    assertThat(collectionsBean.getLinkedBlockingDeque()).isEmpty();
    assertThat(collectionsBean.getConcurrentLinkedDeque()).isEmpty();
}
 
开发者ID:benas,项目名称:random-beans,代码行数:27,代码来源:CollectionPopulatorTest.java


示例15: unboundedWildCardTypedCollectionClassesShouldBeEmpty

import io.github.benas.randombeans.api.EnhancedRandom; //导入依赖的package包/类
@Test
public void unboundedWildCardTypedCollectionClassesShouldBeEmpty() {
    EnhancedRandom enhancedRandom = aNewEnhancedRandom();

    final WildCardCollectionBean collectionsBean = enhancedRandom.nextObject(WildCardCollectionBean.class);

    assertThat(collectionsBean).isNotNull();

    assertThat(collectionsBean.getUnboundedWildCardTypedArrayList()).isEmpty();
    assertThat(collectionsBean.getUnboundedWildCardTypedLinkedList()).isEmpty();
    assertThat(collectionsBean.getUnboundedWildCardTypedVector()).isEmpty();
    assertThat(collectionsBean.getUnboundedWildCardTypedStack()).isEmpty();
    assertThat(collectionsBean.getUnboundedWildCardTypedHashSet()).isEmpty();
    assertThat(collectionsBean.getUnboundedWildCardTypedLinkedHashSet()).isEmpty();
    assertThat(collectionsBean.getUnboundedWildCardTypedTreeSet()).isEmpty();
    assertThat(collectionsBean.getUnboundedWildCardTypedConcurrentSkipListSet()).isEmpty();
    assertThat(collectionsBean.getUnboundedWildCardTypedArrayBlockingQueue()).isEmpty();
    assertThat(collectionsBean.getUnboundedWildCardTypedLinkedBlockingQueue()).isEmpty();
    assertThat(collectionsBean.getUnboundedWildCardTypedConcurrentLinkedQueue()).isEmpty();
    assertThat(collectionsBean.getUnboundedWildCardTypedLinkedTransferQueue()).isEmpty();
    assertThat(collectionsBean.getUnboundedWildCardTypedPriorityQueue()).isEmpty();
    assertThat(collectionsBean.getUnboundedWildCardTypedPriorityBlockingQueue()).isEmpty();
    assertThat(collectionsBean.getUnboundedWildCardTypedArrayDeque()).isEmpty();
    assertThat(collectionsBean.getUnboundedWildCardTypedLinkedBlockingDeque()).isEmpty();
    assertThat(collectionsBean.getUnboundedWildCardTypedConcurrentLinkedDeque()).isEmpty();
}
 
开发者ID:benas,项目名称:random-beans,代码行数:27,代码来源:CollectionPopulatorTest.java


示例16: boundedWildCardTypedCollectionClassesShouldBeEmpty

import io.github.benas.randombeans.api.EnhancedRandom; //导入依赖的package包/类
@Test
public void boundedWildCardTypedCollectionClassesShouldBeEmpty() {
    EnhancedRandom enhancedRandom = aNewEnhancedRandom();

    final WildCardCollectionBean collectionsBean = enhancedRandom.nextObject(WildCardCollectionBean.class);

    assertThat(collectionsBean).isNotNull();

    assertThat(collectionsBean.getBoundedWildCardTypedArrayList()).isEmpty();
    assertThat(collectionsBean.getBoundedWildCardTypedLinkedList()).isEmpty();
    assertThat(collectionsBean.getBoundedWildCardTypedVector()).isEmpty();
    assertThat(collectionsBean.getBoundedWildCardTypedStack()).isEmpty();
    assertThat(collectionsBean.getBoundedWildCardTypedHashSet()).isEmpty();
    assertThat(collectionsBean.getBoundedWildCardTypedLinkedHashSet()).isEmpty();
    assertThat(collectionsBean.getBoundedWildCardTypedTreeSet()).isEmpty();
    assertThat(collectionsBean.getBoundedWildCardTypedConcurrentSkipListSet()).isEmpty();
    assertThat(collectionsBean.getBoundedWildCardTypedArrayBlockingQueue()).isEmpty();
    assertThat(collectionsBean.getBoundedWildCardTypedLinkedBlockingQueue()).isEmpty();
    assertThat(collectionsBean.getBoundedWildCardTypedConcurrentLinkedQueue()).isEmpty();
    assertThat(collectionsBean.getBoundedWildCardTypedLinkedTransferQueue()).isEmpty();
    assertThat(collectionsBean.getBoundedWildCardTypedPriorityQueue()).isEmpty();
    assertThat(collectionsBean.getBoundedWildCardTypedPriorityBlockingQueue()).isEmpty();
    assertThat(collectionsBean.getBoundedWildCardTypedArrayDeque()).isEmpty();
    assertThat(collectionsBean.getBoundedWildCardTypedLinkedBlockingDeque()).isEmpty();
    assertThat(collectionsBean.getBoundedWildCardTypedConcurrentLinkedDeque()).isEmpty();
}
 
开发者ID:benas,项目名称:random-beans,代码行数:27,代码来源:CollectionPopulatorTest.java


示例17: typedCollectionClassesShouldNoBeEmpty

import io.github.benas.randombeans.api.EnhancedRandom; //导入依赖的package包/类
@Test
public void typedCollectionClassesShouldNoBeEmpty() {
    EnhancedRandom enhancedRandom = aNewEnhancedRandom();

    final CollectionBean collectionsBean = enhancedRandom.nextObject(CollectionBean.class);

    assertThat(collectionsBean).isNotNull();

    assertContainsOnlyNonEmptyPersons(collectionsBean.getTypedArrayList());
    assertContainsOnlyNonEmptyPersons(collectionsBean.getTypedLinkedList());
    assertContainsOnlyNonEmptyPersons(collectionsBean.getTypedVector());
    assertContainsOnlyNonEmptyPersons(collectionsBean.getTypedStack());
    assertContainsOnlyNonEmptyPersons(collectionsBean.getTypedHashSet());
    assertContainsOnlyNonEmptyPersons(collectionsBean.getTypedLinkedHashSet());
    assertContainsOnlyNonEmptyPersons(collectionsBean.getTypedTreeSet());
    assertContainsOnlyNonEmptyPersons(collectionsBean.getTypedConcurrentSkipListSet());
    assertContainsOnlyNonEmptyPersons(collectionsBean.getTypedArrayBlockingQueue());
    assertContainsOnlyNonEmptyPersons(collectionsBean.getTypedLinkedBlockingQueue());
    assertContainsOnlyNonEmptyPersons(collectionsBean.getTypedConcurrentLinkedQueue());
    assertContainsOnlyNonEmptyPersons(collectionsBean.getTypedLinkedTransferQueue());
    assertContainsOnlyNonEmptyPersons(collectionsBean.getTypedPriorityQueue());
    assertContainsOnlyNonEmptyPersons(collectionsBean.getTypedPriorityBlockingQueue());
    assertContainsOnlyNonEmptyPersons(collectionsBean.getTypedArrayDeque());
    assertContainsOnlyNonEmptyPersons(collectionsBean.getTypedLinkedBlockingDeque());
    assertContainsOnlyNonEmptyPersons(collectionsBean.getTypedConcurrentLinkedDeque());
}
 
开发者ID:benas,项目名称:random-beans,代码行数:27,代码来源:CollectionPopulatorTest.java


示例18: primitiveArraysShouldBeCorrectlyPopulated

import io.github.benas.randombeans.api.EnhancedRandom; //导入依赖的package包/类
@Test
public void primitiveArraysShouldBeCorrectlyPopulated() {
    EnhancedRandom enhancedRandom = aNewEnhancedRandom();

    final ArrayBean bean = enhancedRandom.nextObject(ArrayBean.class);

    // primitive types
    assertThat(toObjectArray(bean.getByteArray())).hasOnlyElementsOfType(Byte.class);
    assertThat(toObjectArray(bean.getShortArray())).hasOnlyElementsOfType(Short.class);
    assertThat(toObjectArray(bean.getIntArray())).hasOnlyElementsOfType(Integer.class);
    assertThat(toObjectArray(bean.getLongArray())).hasOnlyElementsOfType(Long.class);
    assertThat(toObjectArray(bean.getFloatArray())).hasOnlyElementsOfType(Float.class);
    assertThat(toObjectArray(bean.getDoubleArray())).hasOnlyElementsOfType(Double.class);
    assertThat(toObjectArray(bean.getCharArray())).hasOnlyElementsOfType(Character.class);
    assertThat(toObjectArray(bean.getBooleanArray())).hasOnlyElementsOfType(Boolean.class);
}
 
开发者ID:benas,项目名称:random-beans,代码行数:17,代码来源:ArrayPopulatorTest.java


示例19: wrapperTypeArraysShouldBeCorrectlyPopulated

import io.github.benas.randombeans.api.EnhancedRandom; //导入依赖的package包/类
@Test
public void wrapperTypeArraysShouldBeCorrectlyPopulated() {
    EnhancedRandom enhancedRandom = aNewEnhancedRandom();

    final ArrayBean bean = enhancedRandom.nextObject(ArrayBean.class);

    // wrapper types
    assertThat(bean.getBytes()).hasOnlyElementsOfType(Byte.class);
    assertThat(bean.getShorts()).hasOnlyElementsOfType(Short.class);
    assertThat(bean.getIntegers()).hasOnlyElementsOfType(Integer.class);
    assertThat(bean.getLongs()).hasOnlyElementsOfType(Long.class);
    assertThat(bean.getFloats()).hasOnlyElementsOfType(Float.class);
    assertThat(bean.getDoubles()).hasOnlyElementsOfType(Double.class);
    assertThat(bean.getCharacters()).hasOnlyElementsOfType(Character.class);
    assertThat(bean.getBooleans()).hasOnlyElementsOfType(Boolean.class);
}
 
开发者ID:benas,项目名称:random-beans,代码行数:17,代码来源:ArrayPopulatorTest.java


示例20: typedMapInterfacesShouldNotBeEmpty

import io.github.benas.randombeans.api.EnhancedRandom; //导入依赖的package包/类
@Test
public void typedMapInterfacesShouldNotBeEmpty() {
    EnhancedRandom enhancedRandom = aNewEnhancedRandom();

    final MapBean mapBean = enhancedRandom.nextObject(MapBean.class);

    assertThat(mapBean).isNotNull();

    assertContainsNonZeroIntegers(mapBean.getTypedMap().keySet());
    assertContainsOnlyNonEmptyPersons(mapBean.getTypedMap().values());

    assertContainsNonZeroIntegers(mapBean.getTypedSortedMap().keySet());
    assertContainsOnlyNonEmptyPersons(mapBean.getTypedSortedMap().values());

    assertContainsNonZeroIntegers(mapBean.getTypedNavigableMap().keySet());
    assertContainsOnlyNonEmptyPersons(mapBean.getTypedNavigableMap().values());

    assertContainsNonZeroIntegers(mapBean.getTypedConcurrentMap().keySet());
    assertContainsOnlyNonEmptyPersons(mapBean.getTypedConcurrentMap().values());

    assertContainsNonZeroIntegers(mapBean.getTypedConcurrentNavigableMap().keySet());
    assertContainsOnlyNonEmptyPersons(mapBean.getTypedConcurrentNavigableMap().values());
}
 
开发者ID:benas,项目名称:random-beans,代码行数:24,代码来源:MapPopulatorTest.java



注:本文中的io.github.benas.randombeans.api.EnhancedRandom类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java JsonSchema类代码示例发布时间:2022-05-23
下一篇:
Java TransactionalEditingDomainImpl类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap