Class Java6AbstractBDDSoftAssertions

    • Constructor Detail

      • Java6AbstractBDDSoftAssertions

        public Java6AbstractBDDSoftAssertions()
    • Method Detail

      • then

        public BigDecimalAssert then​(java.math.BigDecimal actual)
        Creates a new instance of BigDecimalAssert.
        Parameters:
        actual - the actual value.
        Returns:
        the created assertion object.
      • then

        public BigIntegerAssert then​(java.math.BigInteger actual)
        Creates a new instance of BigIntegerAssert.
        Parameters:
        actual - the actual value.
        Returns:
        the created assertion object.
        Since:
        2.7.0 / 3.7.0
      • then

        public BooleanAssert then​(boolean actual)
        Creates a new instance of BooleanAssert.
        Parameters:
        actual - the actual value.
        Returns:
        the created assertion object.
      • then

        public BooleanAssert then​(java.lang.Boolean actual)
        Creates a new instance of BooleanAssert.
        Parameters:
        actual - the actual value.
        Returns:
        the created assertion object.
      • then

        public BooleanArrayAssert then​(boolean[] actual)
        Creates a new instance of BooleanArrayAssert.
        Parameters:
        actual - the actual value.
        Returns:
        the created assertion object.
      • then

        public ByteAssert then​(byte actual)
        Creates a new instance of ByteAssert.
        Parameters:
        actual - the actual value.
        Returns:
        the created assertion object.
      • then

        public ByteAssert then​(java.lang.Byte actual)
        Creates a new instance of ByteAssert.
        Parameters:
        actual - the actual value.
        Returns:
        the created assertion object.
      • then

        public ByteArrayAssert then​(byte[] actual)
        Creates a new instance of ByteArrayAssert.
        Parameters:
        actual - the actual value.
        Returns:
        the created assertion object.
      • then

        public CharacterAssert then​(char actual)
        Creates a new instance of CharacterAssert.
        Parameters:
        actual - the actual value.
        Returns:
        the created assertion object.
      • then

        public CharArrayAssert then​(char[] actual)
        Creates a new instance of CharArrayAssert.
        Parameters:
        actual - the actual value.
        Returns:
        the created assertion object.
      • then

        public CharacterAssert then​(java.lang.Character actual)
        Creates a new instance of CharacterAssert.
        Parameters:
        actual - the actual value.
        Returns:
        the created assertion object.
      • then

        public SoftAssertionClassAssert then​(java.lang.Class<?> actual)
        Creates a new instance of ClassAssert

        We don't return ClassAssert as it has overridden methods to annotated with SafeVarargs.
        Parameters:
        actual - the actual value.
        Returns:
        the created assertion object.
      • then

        public <T extends java.lang.Comparable<? super T>> AbstractComparableAssert<?,​T> then​(T actual)
        Creates a new instance of GenericComparableAssert with standard comparison semantics.
        Parameters:
        actual - the actual value.
        Returns:
        the created assertion object.
      • then

        public <T> SoftAssertionIterableAssert<T> then​(java.lang.Iterable<? extends T> actual)
        Creates a new instance of IterableAssert.
        Parameters:
        actual - the actual value.
        Returns:
        the created assertion object.
      • then

        public <T> SoftAssertionIterableAssert<T> then​(java.util.Iterator<T> actual)
        Creates a new instance of IterableAssert. The Iterator is first converted into an Iterable
        Parameters:
        actual - the actual value.
        Returns:
        the created assertion object.
      • then

        public DoubleAssert then​(double actual)
        Creates a new instance of DoubleAssert.
        Parameters:
        actual - the actual value.
        Returns:
        the created assertion object.
      • then

        public DoubleAssert then​(java.lang.Double actual)
        Creates a new instance of DoubleAssert.
        Parameters:
        actual - the actual value.
        Returns:
        the created assertion object.
      • then

        public DoubleArrayAssert then​(double[] actual)
        Creates a new instance of DoubleArrayAssert.
        Parameters:
        actual - the actual value.
        Returns:
        the created assertion object.
      • then

        public FileAssert then​(java.io.File actual)
        Creates a new instance of FileAssert.
        Parameters:
        actual - the actual value.
        Returns:
        the created assertion object.
      • then

        public <RESULT> FutureAssert<RESULT> then​(java.util.concurrent.Future<RESULT> actual)
        Creates a new instance of FutureAssert.
        Parameters:
        actual - the actual value.
        Returns:
        the created assertion object.
        Since:
        2.7.0 / 3.7.0
      • then

        public InputStreamAssert then​(java.io.InputStream actual)
        Creates a new instance of InputStreamAssert.
        Parameters:
        actual - the actual value.
        Returns:
        the created assertion object.
      • then

        public FloatAssert then​(float actual)
        Creates a new instance of FloatAssert.
        Parameters:
        actual - the actual value.
        Returns:
        the created assertion object.
      • then

        public FloatAssert then​(java.lang.Float actual)
        Creates a new instance of FloatAssert.
        Parameters:
        actual - the actual value.
        Returns:
        the created assertion object.
      • then

        public FloatArrayAssert then​(float[] actual)
        Creates a new instance of FloatArrayAssert.
        Parameters:
        actual - the actual value.
        Returns:
        the created assertion object.
      • then

        public IntegerAssert then​(int actual)
        Creates a new instance of IntegerAssert.
        Parameters:
        actual - the actual value.
        Returns:
        the created assertion object.
      • then

        public IntArrayAssert then​(int[] actual)
        Creates a new instance of IntArrayAssert.
        Parameters:
        actual - the actual value.
        Returns:
        the created assertion object.
      • then

        public IntegerAssert then​(java.lang.Integer actual)
        Creates a new instance of IntegerAssert.
        Parameters:
        actual - the actual value.
        Returns:
        the created assertion object.
      • then

        public <T> SoftAssertionListAssert<T> then​(java.util.List<? extends T> actual)
        Creates a new instance of ListAssert.
        Parameters:
        actual - the actual value.
        Returns:
        the created assertion object.
      • then

        public LongAssert then​(long actual)
        Creates a new instance of LongAssert.
        Parameters:
        actual - the actual value.
        Returns:
        the created assertion object.
      • then

        public LongAssert then​(java.lang.Long actual)
        Creates a new instance of LongAssert.
        Parameters:
        actual - the actual value.
        Returns:
        the created assertion object.
      • then

        public LongArrayAssert then​(long[] actual)
        Creates a new instance of LongArrayAssert.
        Parameters:
        actual - the actual value.
        Returns:
        the created assertion object.
      • then

        public <T> ObjectAssert<T> then​(T actual)
        Creates a new instance of ObjectAssert.
        Parameters:
        actual - the actual value.
        Returns:
        the created assertion object.
      • then

        public <T> ObjectArrayAssert<T> then​(T[] actual)
        Creates a new instance of ObjectArrayAssert.
        Parameters:
        actual - the actual value.
        Returns:
        the created assertion object.
      • then

        public <K,​V> SoftAssertionMapAssert<K,​V> then​(java.util.Map<K,​V> actual)
        Creates a new instance of MapAssert.

        We don't return MapAssert as it has overridden methods to annotated with SafeVarargs.
        Parameters:
        actual - the actual value.
        Returns:
        the created assertion object.
      • then

        public ShortAssert then​(short actual)
        Creates a new instance of ShortAssert.
        Parameters:
        actual - the actual value.
        Returns:
        the created assertion object.
      • then

        public ShortAssert then​(java.lang.Short actual)
        Creates a new instance of ShortAssert.
        Parameters:
        actual - the actual value.
        Returns:
        the created assertion object.
      • then

        public ShortArrayAssert then​(short[] actual)
        Creates a new instance of ShortArrayAssert.
        Parameters:
        actual - the actual value.
        Returns:
        the created assertion object.
      • then

        public CharSequenceAssert then​(java.lang.CharSequence actual)
        Creates a new instance of CharSequenceAssert.
        Parameters:
        actual - the actual value.
        Returns:
        the created assertion object.
      • then

        public StringAssert then​(java.lang.String actual)
        Creates a new instance of StringAssert.
        Parameters:
        actual - the actual value.
        Returns:
        the created assertion object.
      • then

        public DateAssert then​(java.util.Date actual)
        Creates a new instance of DateAssert.
        Parameters:
        actual - the actual value.
        Returns:
        the created assertion object.
      • then

        public AtomicBooleanAssert then​(java.util.concurrent.atomic.AtomicBoolean actual)
        Create assertion for AtomicBoolean.
        Parameters:
        actual - the actual value.
        Returns:
        the created assertion object.
        Since:
        2.7.0 / 3.7.0
      • then

        public AtomicIntegerAssert then​(java.util.concurrent.atomic.AtomicInteger actual)
        Create assertion for AtomicInteger.
        Parameters:
        actual - the actual value.
        Returns:
        the created assertion object.
        Since:
        2.7.0 / 3.7.0
      • then

        public AtomicIntegerArrayAssert then​(java.util.concurrent.atomic.AtomicIntegerArray actual)
        Create assertion for AtomicIntegerArray.
        Parameters:
        actual - the actual value.
        Returns:
        the created assertion object.
        Since:
        2.7.0 / 3.7.0
      • then

        public <OBJECT> AtomicIntegerFieldUpdaterAssert<OBJECT> then​(java.util.concurrent.atomic.AtomicIntegerFieldUpdater<OBJECT> actual)
        Create assertion for AtomicIntegerFieldUpdater.
        Parameters:
        actual - the actual value.
        Returns:
        the created assertion object.
        Since:
        2.7.0 / 3.7.0
      • then

        public AtomicLongAssert then​(java.util.concurrent.atomic.AtomicLong actual)
        Create assertion for AtomicLong.
        Parameters:
        actual - the actual value.
        Returns:
        the created assertion object.
        Since:
        2.7.0 / 3.7.0
      • then

        public AtomicLongArrayAssert then​(java.util.concurrent.atomic.AtomicLongArray actual)
        Create assertion for AtomicLongArray.
        Parameters:
        actual - the actual value.
        Returns:
        the created assertion object.
        Since:
        2.7.0 / 3.7.0
      • then

        public <OBJECT> AtomicLongFieldUpdaterAssert<OBJECT> then​(java.util.concurrent.atomic.AtomicLongFieldUpdater<OBJECT> actual)
        Create assertion for AtomicLongFieldUpdater.
        Parameters:
        actual - the actual value.
        Returns:
        the created assertion object.
        Since:
        2.7.0 / 3.7.0
      • then

        public <VALUE> AtomicReferenceAssert<VALUE> then​(java.util.concurrent.atomic.AtomicReference<VALUE> actual)
        Create assertion for AtomicReference.
        Parameters:
        actual - the actual value.
        Returns:
        the created assertion object.
        Since:
        2.7.0 / 3.7.0
      • then

        public <ELEMENT> AtomicReferenceArrayAssert<ELEMENT> then​(java.util.concurrent.atomic.AtomicReferenceArray<ELEMENT> actual)
        Create assertion for AtomicReferenceArray.
        Type Parameters:
        ELEMENT - the type of object referred to by the AtomicReferenceArray.
        Parameters:
        actual - the actual value.
        Returns:
        the created assertion object.
        Since:
        2.7.0 / 3.7.0
      • then

        public <FIELD,​OBJECT> AtomicReferenceFieldUpdaterAssert<FIELD,​OBJECT> then​(java.util.concurrent.atomic.AtomicReferenceFieldUpdater<OBJECT,​FIELD> actual)
        Create assertion for AtomicReferenceFieldUpdater.
        Parameters:
        actual - the actual value.
        Returns:
        the created assertion object.
        Since:
        2.7.0 / 3.7.0
      • then

        public <VALUE> AtomicMarkableReferenceAssert<VALUE> then​(java.util.concurrent.atomic.AtomicMarkableReference<VALUE> actual)
        Create assertion for AtomicMarkableReference.
        Parameters:
        actual - the actual value.
        Returns:
        the created assertion object.
        Since:
        2.7.0 / 3.7.0
      • then

        public <VALUE> AtomicStampedReferenceAssert<VALUE> then​(java.util.concurrent.atomic.AtomicStampedReference<VALUE> actual)
        Create assertion for AtomicStampedReference.
        Parameters:
        actual - the actual value.
        Returns:
        the created assertion object.
        Since:
        2.7.0 / 3.7.0
      • then

        public ThrowableAssert then​(java.lang.Throwable actual)
        Creates a new instance of ThrowableAssert.
        Parameters:
        actual - the actual value.
        Returns:
        the created assertion Throwable.
      • thenThrownBy

        public AbstractThrowableAssert<?,​? extends java.lang.Throwable> thenThrownBy​(ThrowableAssert.ThrowingCallable shouldRaiseThrowable)
        Allows to capture and then assert on a Throwable more easily when used with Java 8 lambdas.

        Java 8 example :

         @Test
          public void testException() {
            BDDSoftAssertions softly = new BDDSoftAssertions();
            softly.thenThrownBy(() -> { throw new Exception("boom!"); }).isInstanceOf(Exception.class)
                                                                       .hasMessageContaining("boom");
          }
        Java 7 example :
         BDDSoftAssertions softly = new BDDSoftAssertions();
         softly.thenThrownBy(new ThrowingCallable() {
        
           @Override
           public Void call() throws Exception {
             throw new Exception("boom!");
           }
        
         }).isInstanceOf(Exception.class)
           .hasMessageContaining("boom");
        Parameters:
        shouldRaiseThrowable - The ThrowableAssert.ThrowingCallable or lambda with the code that should raise the throwable.
        Returns:
        The captured exception or null if none was raised by the callable.
      • thenCode

        public AbstractThrowableAssert<?,​? extends java.lang.Throwable> thenCode​(ThrowableAssert.ThrowingCallable shouldRaiseOrNotThrowable)
        Allows to capture and then assert on a Throwable more easily when used with Java 8 lambdas.

        Example :

         ThrowingCallable callable = () -> {
           throw new Exception("boom!");
         };
         
         // assertion succeeds
         thenCode(callable).isInstanceOf(Exception.class)
                           .hasMessageContaining("boom");
                                                              
         // assertion fails
         thenCode(callable).doesNotThrowAnyException();
        If the provided ThrowableAssert.ThrowingCallable does not validate against next assertions, an error is immediately raised, in that case the test description provided with as(String, Object...) is not honored.
        To use a test description, use thenCode(ThrowableAssert.ThrowingCallable) as shown below.
         ThrowingCallable doNothing = () -> {
           // do nothing 
         }; 
         
         // assertion fails and "display me" appears in the assertion error
         thenCode(doNothing).as("display me")
                            .isInstanceOf(Exception.class);
        
         // assertion will fail AND "display me" will appear in the error
         Throwable thrown = catchThrowable(doNothing);
         thenCode(thrown).as("display me")
                         .isInstanceOf(Exception.class); 

        This method was not named then because the java compiler reported it ambiguous when used directly with a lambda :(

        Parameters:
        shouldRaiseOrNotThrowable - The ThrowableAssert.ThrowingCallable or lambda with the code that should raise the throwable.
        Returns:
        The captured exception or null if none was raised by the callable.
        Since:
        3.7.0
      • then

        public UriAssert then​(java.net.URI actual)
        Creates a new instance of UriAssert.
        Parameters:
        actual - the actual value.
        Returns:
        the created assertion object.
      • then

        public AbstractUrlAssert<?> then​(java.net.URL actual)
        Creates a new instance of UrlAssert.
        Parameters:
        actual - the actual value.
        Returns:
        the created assertion object.