コード例 #1
0
 @Test
 public void should_fail_if_actual_is_less_than_other_according_to_custom_comparison_strategy() {
   AssertionInfo info = someInfo();
   try {
     bigDecimalsWithAbsValueComparisonStrategy.assertLessThan(info, TEN.negate(), ONE);
   } catch (AssertionError e) {
     verify(failures).failure(info, shouldBeLess(TEN.negate(), ONE, absValueComparisonStrategy));
     return;
   }
   expectedAssertionErrorNotThrown();
 }
 @Override
 protected void primeSourceOfRandomness() {
   first = TEN.subtract(TEN.negate());
   second = TEN.pow(2).subtract(TEN.pow(2).negate());
   third = TEN.pow(3).subtract(TEN.pow(3).negate());
   when(randomForParameterGenerator.nextBigInteger(first.toBigInteger().bitLength()))
       .thenReturn(new BigInteger("999999999999"))
       .thenReturn(BigInteger.ONE);
   when(randomForParameterGenerator.nextBigInteger(second.toBigInteger().bitLength()))
       .thenReturn(new BigInteger("136"));
   when(randomForParameterGenerator.nextBigInteger(third.toBigInteger().bitLength()))
       .thenReturn(new BigInteger("768"));
   when(distro.sampleWithMean(1, randomForParameterGenerator)).thenReturn(0);
   when(distro.sampleWithMean(2, randomForParameterGenerator)).thenReturn(1);
   when(distro.sampleWithMean(3, randomForParameterGenerator)).thenReturn(2);
 }
コード例 #3
0
 @Test
 public void should_pass_if_actual_is_less_than_other_according_to_custom_comparison_strategy() {
   bigDecimalsWithAbsValueComparisonStrategy.assertLessThan(someInfo(), ONE, TEN.negate());
 }