Class AtomicReferenceAssert<V>

    • Constructor Detail

      • AtomicReferenceAssert

        public AtomicReferenceAssert​(AtomicReference<V> actual)
    • Method Detail

      • hasValue

        public AtomicReferenceAssert<V> hasValue​(V expectedValue)
        Verifies that the actual atomic has the given value.

        Example:

         // assertion will pass
         assertThat(new AtomicReference("foo")).hasValue("foo");
        
         // assertion will fail
         assertThat(new AtomicReference("foo")).hasValue("bar");
        Parameters:
        expectedValue - the expected value.
        Returns:
        this assertion object.
        Throws:
        AssertionError - if the actual atomic is null.
        AssertionError - if the actual atomic does not have the given value.
        Since:
        2.7.0 / 3.7.0
      • doesNotHaveValue

        public AtomicReferenceAssert<V> doesNotHaveValue​(V nonExpectedValue)
        Verifies that the actual atomic has not the given value.

        Example:

         // assertion will pass
         assertThat(new AtomicReference("foo")).doesNotHaveValue("bar");
        
         // assertion will fail
         assertThat(new AtomicReference("foo")).doesNotHaveValue("foo");
        Parameters:
        nonExpectedValue - the value not expected.
        Returns:
        this assertion object.
        Throws:
        AssertionError - if the actual atomic is null.
        AssertionError - if the actual atomic has the given value.
        Since:
        2.7.0 / 3.7.0