MCPcopy Index your code
hub / github.com/assertj/assertj / ObjectArrays

Class ObjectArrays

src/main/java/org/assertj/core/internal/ObjectArrays.java:34–513  ·  view source on GitHub ↗

Reusable assertions for arrays of objects. @author Alex Ruiz @author Joel Costigliola @author Nicolas François @author Mikhail Mazursky

Source from the content-addressed store, hash-verified

32 * @author Mikhail Mazursky
33 */
34public class ObjectArrays {
35
36 private static final ObjectArrays INSTANCE = new ObjectArrays();
37
38 /**
39 * Returns the singleton instance of this class.
40 *
41 * @return the singleton instance of this class.
42 */
43 public static ObjectArrays instance() {
44 return INSTANCE;
45 }
46
47 private Arrays arrays = Arrays.instance();
48
49 @VisibleForTesting
50 ObjectArrays() {
51 this(StandardComparisonStrategy.instance());
52 }
53
54 public ObjectArrays(ComparisonStrategy comparisonStrategy) {
55 this.arrays = new Arrays(comparisonStrategy);
56 }
57
58 @VisibleForTesting
59 public Comparator<?> getComparator() {
60 return arrays.getComparator();
61 }
62
63 @VisibleForTesting
64 Failures failures = Failures.instance();
65
66 @VisibleForTesting
67 Conditions conditions = Conditions.instance();
68
69 /**
70 * Asserts that the given array is {@code null} or empty.
71 *
72 * @param info contains information about the assertion.
73 * @param actual the given array.
74 * @throws AssertionError if the given array is not {@code null} *and* contains one or more elements.
75 */
76 public void assertNullOrEmpty(AssertionInfo info, Object[] actual) {
77 arrays.assertNullOrEmpty(info, failures, actual);
78 }
79
80 /**
81 * Asserts that the given array is empty.
82 *
83 * @param info contains information about the assertion.
84 * @param actual the given array.
85 * @throws AssertionError if the given array is {@code null}.
86 * @throws AssertionError if the given array is not empty.
87 */
88 public void assertEmpty(AssertionInfo info, Object[] actual) {
89 arrays.assertEmpty(info, failures, actual);
90 }
91

Callers

nothing calls this directly

Calls 3

instanceMethod · 0.95
instanceMethod · 0.95
instanceMethod · 0.95

Tested by

no test coverage detected