当前位置: 首页>>代码示例>>Java>>正文


Java When类代码示例

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


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

示例1: primeFactorsForEvenNumbersShouldContain2

import com.pholser.junit.quickcheck.When; //导入依赖的package包/类
@Property(maxShrinkDepth = 100, maxShrinks = 1000)
public void primeFactorsForEvenNumbersShouldContain2(
		@InRange(min = "2", max = "9999999999999") @When(seed = -6527596145222155897L) final Long i)
{
	assumeThat(i % 2, is(0L));
	assertThat(sut.factor(i)).contains(2L);
}
 
开发者ID:StefanMacke,项目名称:pbt-junit-quickcheck,代码行数:8,代码来源:PrimeFactorCalculatorProperties.java

示例2: testSignedFromWithInvalid

import com.pholser.junit.quickcheck.When; //导入依赖的package包/类
@Property(trials = 30)
public void testSignedFromWithInvalid(@When(satisfies = "#_ < -128 || #_ > 127") int byteValue){
    try {
        RoxByte.signedFrom(byteValue);
        fail(byteValue + " was expected to be too low to convert to unsigned byte");
    }catch(InvalidDataTypeException e) {
        assertNotNull(e);
    }
}
 
开发者ID:rossdrew,项目名称:emuRox,代码行数:10,代码来源:RoxByteTest.java

示例3: testWithBitInvalidChoice

import com.pholser.junit.quickcheck.When; //导入依赖的package包/类
@Property(trials = 5)
public void testWithBitInvalidChoice(@When(satisfies = "#_ < 0 || #_ > 7") int bit){
    final RoxByte myByte = RoxByte.ZERO;

    try {
        myByte.withBit(bit);
        fail("There is no bit " + bit + ", this should throw an error");
    }catch(ArrayIndexOutOfBoundsException e){
        assertNotNull(e);
    }
}
 
开发者ID:rossdrew,项目名称:emuRox,代码行数:12,代码来源:RoxByteTest.java

示例4: testWithoutBitInvalidChoice

import com.pholser.junit.quickcheck.When; //导入依赖的package包/类
@Property(trials = 5)
public void testWithoutBitInvalidChoice(@When(satisfies = "#_ < 0 || #_ > 7") int bit){
    final RoxByte myByte = RoxByte.ZERO;

    try {
        myByte.withoutBit(bit);
        fail("There is no bit " + bit + ", this should throw an error");
    }catch(ArrayIndexOutOfBoundsException e){
        assertNotNull(e);
    }
}
 
开发者ID:rossdrew,项目名称:emuRox,代码行数:12,代码来源:RoxByteTest.java

示例5: testIsBitSetInvalidChoice

import com.pholser.junit.quickcheck.When; //导入依赖的package包/类
@Property(trials = 5)
public void testIsBitSetInvalidChoice(@When(satisfies = "#_ < 0 || #_ > 7") int bit){
    final RoxByte myByte = RoxByte.ZERO;

    try {
        myByte.isBitSet(bit);
        fail("There is no bit " + bit + ", this should throw an error");
    }catch(ArrayIndexOutOfBoundsException e){
        assertNotNull(e);
    }
}
 
开发者ID:rossdrew,项目名称:emuRox,代码行数:12,代码来源:RoxByteTest.java

示例6: testInvalidImmediateADC

import com.pholser.junit.quickcheck.When; //导入依赖的package包/类
@Property (trials = 100)
public void testInvalidImmediateADC(@When(satisfies = "#_ < 0 || #_ > 255") int value){
    Program program = new Program().with(LDA_I, value);
    memory.setBlock(0, program.getProgramAsByteArray());

    processor.step();

    Registers registers = processor.getRegisters();
    assertNotEquals(value, registers.getRegister(Registers.REG_ACCUMULATOR));
    assertEquals(program.getLength(), registers.getPC());
}
 
开发者ID:rossdrew,项目名称:emuRox,代码行数:12,代码来源:CPUProperty.java

示例7: testInvalidFlagPlaceValueToFlagID

import com.pholser.junit.quickcheck.When; //导入依赖的package包/类
@Property(trials = 10)
public void testInvalidFlagPlaceValueToFlagID(@When(satisfies = "#_ < 0 || #_ > 128") int placeValue){
    try{
        Registers.getFlagID(placeValue);
        fail("Place value " + Integer.toHexString(placeValue) + " should be invalid.");
    }catch(IllegalArgumentException e){
        assertNotNull(e);
    }
}
 
开发者ID:rossdrew,项目名称:emuRox,代码行数:10,代码来源:RegistersTest.java

示例8: allowAtMostOneFailsWithCustomException

import com.pholser.junit.quickcheck.When; //导入依赖的package包/类
@Property
public void allowAtMostOneFailsWithCustomException(@When(satisfies = " #_.size() > 1") List<?> tooManyElements) {
    expectedException.expect(IllegalStateException.class);
    tooManyElements.stream().collect(allowAtMostOneOrElseThrow((first, excess) -> {
        assertThat(first, is(tooManyElements.get(0)));
        assertThat(excess, is(tooManyElements.get(1)));
        return new IllegalStateException();
    }));
}
 
开发者ID:digipost,项目名称:digg,代码行数:10,代码来源:DiggCollectorsTest.java

示例9: friendlyClassNameIsJustTheSimpleName

import com.pholser.junit.quickcheck.When; //导入依赖的package包/类
@Property
public void friendlyClassNameIsJustTheSimpleName(@When(satisfies = "#_ != null") Object anyInstanceOfNonNestedClass) {
    Class<?> anyNonNestedClass = anyInstanceOfNonNestedClass.getClass();
    assumeThat(anyNonNestedClass.getEnclosingClass(), nullValue());
    assertThat(friendlyName(anyNonNestedClass), is(anyNonNestedClass.getSimpleName()));
}
 
开发者ID:digipost,项目名称:digg,代码行数:7,代码来源:DiggBaseTest.java

示例10: allowAtMostOneFails

import com.pholser.junit.quickcheck.When; //导入依赖的package包/类
@Property
public void allowAtMostOneFails(@When(satisfies = " #_.size() > 1") List<?> tooManyElements) {
    expectedException.expect(ViewableAsOptional.TooManyElements.class);
    tooManyElements.stream().parallel().collect(allowAtMostOne());
}
 
开发者ID:digipost,项目名称:digg,代码行数:6,代码来源:DiggCollectorsTest.java


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