use of java.util.concurrent.atomic.AtomicIntegerArray in project assertj-core by joel-costigliola.
the class SoftAssertionsTest method should_work_with_atomic.
@Test
void should_work_with_atomic() {
// WHEN
// simple atomic value
softly.assertThat(new AtomicBoolean(true)).isTrue().isFalse();
softly.assertThat(new AtomicInteger(1)).hasValueGreaterThan(0).hasNegativeValue();
softly.assertThat(new AtomicLong(1L)).hasValueGreaterThan(0L).hasNegativeValue();
softly.assertThat(new AtomicReference<>("abc")).hasValue("abc").hasValue("def");
// atomic array value
softly.assertThat(new AtomicIntegerArray(new int[] { 1, 2, 3 })).containsExactly(1, 2, 3).isEmpty();
softly.assertThat(new AtomicLongArray(new long[] { 1L, 2L, 3L })).containsExactly(1L, 2L, 3L).contains(0);
softly.assertThat(new AtomicReferenceArray<>(array("a", "b", "c"))).containsExactly("a", "b", "c").contains("123");
// THEN
List<Throwable> errorsCollected = softly.errorsCollected();
assertThat(errorsCollected).hasSize(7);
assertThat(errorsCollected.get(0)).hasMessageContaining("false");
assertThat(errorsCollected.get(1)).hasMessageContaining("0");
assertThat(errorsCollected.get(2)).hasMessageContaining("0L");
assertThat(errorsCollected.get(3)).hasMessageContaining("def");
assertThat(errorsCollected.get(4)).hasMessageContaining("empty");
assertThat(errorsCollected.get(5)).hasMessageContaining("0");
assertThat(errorsCollected.get(6)).hasMessageContaining("123");
}
use of java.util.concurrent.atomic.AtomicIntegerArray in project assertj-core by joel-costigliola.
the class Arrays_array_Test method should_return_an_int_array_from_AtomicIntegerArray.
@Test
void should_return_an_int_array_from_AtomicIntegerArray() {
// GIVEN
int[] expected = new int[] { 1, 2, 3, 4 };
AtomicIntegerArray atomicIntegerArray = new AtomicIntegerArray(expected);
// WHEN
int[] actual = array(atomicIntegerArray);
// THEN
assertThat(actual).isEqualTo(expected);
}
use of java.util.concurrent.atomic.AtomicIntegerArray in project assertj-core by joel-costigliola.
the class AtomicIntegerArrayAssert_usingElementComparator_Test method should_honor_the_given_element_comparator.
@Test
void should_honor_the_given_element_comparator() {
AtomicIntegerArray actual = new AtomicIntegerArray(new int[] { 1, 2, 3, 4 });
assertThat(actual).usingElementComparator(new AbsValueComparator<Integer>()).containsExactly(-1, 2, 3, -4);
}
use of java.util.concurrent.atomic.AtomicIntegerArray in project assertj-core by joel-costigliola.
the class AtomicIntegerArrayAssert_isNullOrEmpty_Test method should_pass_if_AtomicIntegerArray_is_null.
@Test
void should_pass_if_AtomicIntegerArray_is_null() {
AtomicIntegerArray array = null;
assertThat(array).isNullOrEmpty();
}
use of java.util.concurrent.atomic.AtomicIntegerArray in project assertj-core by joel-costigliola.
the class DualValue_atomicValues_Test method isActualFieldAnAtomicIntegerArray_should_return_true_when_actual_is_an_AtomicIntegerArray.
// AtomicIntegerArray
@Test
void isActualFieldAnAtomicIntegerArray_should_return_true_when_actual_is_an_AtomicIntegerArray() {
// GIVEN
DualValue dualValue = new DualValue(PATH, new AtomicIntegerArray(new int[] { 1, 2, 3 }), "");
// WHEN
boolean isActualFieldAnAtomicIntegerArray = dualValue.isActualFieldAnAtomicIntegerArray();
// THEN
then(isActualFieldAnAtomicIntegerArray).isTrue();
}
Aggregations