EscSpiUtils { public static boolean eventsEqual(@Nullable final List<CommonEvent> eventsA, @Nullable final List<CommonEvent> eventsB) { if ((eventsA == null) && (eventsB == null)) { return true; } if ((eventsA == null) && (eventsB != null)) { return false; } if ((eventsA != null) && (eventsB == null)) { return false; } if (eventsA.size() != eventsB.size()) { return false; } int currentIdx = eventsA.size() - 1; int appendIdx = eventsB.size() - 1; while (appendIdx >= 0) { final CommonEvent current = eventsA.get(currentIdx); final CommonEvent append = eventsB.get(appendIdx); if (!current.equals(append)) { return false; } currentIdx--; appendIdx--; } return true; } private  EscSpiUtils(); @Nullable static SerializedData serialize(@NotNull final SerializerRegistry registry, @NotNull final SerializedDataType type,
            @Nullable final Object data); @NotNull static T deserialize(@NotNull final DeserializerRegistry registry, @NotNull final SerializedData data); static EnhancedMimeType mimeType(@NotNull final SerializerRegistry registry, @NotNull final List<CommonEvent> commonEvents); static List<T> asList(final T[] array); static boolean eventsEqual(@Nullable final List<CommonEvent> eventsA, @Nullable final List<CommonEvent> eventsB); static EscMeta createEscMeta(@NotNull final SerializerRegistry registry, @NotNull final EnhancedMimeType targetContentType,
            @Nullable final CommonEvent commonEvent); static String nodeToString(final Node node); static JsonbSerializer<?>[] createEscJsonbSerializers(); static JsonbSerializer<?>[] joinJsonbSerializers(final JsonbSerializer<?>[] serializersA,
            final JsonbSerializer<?>... serializersB); static JsonbSerializer<?>[] joinJsonbSerializerArrays(final JsonbSerializer<?>[]... serializerArrays); static JsonbDeserializer<?>[] createEscJsonbDeserializers(); static JsonbDeserializer<?>[] joinJsonbDeserializers(final JsonbDeserializer<?>[] deserializersA,
            final JsonbDeserializer<?>... deserializersB); static JsonbDeserializer<?>[] joinJsonbDeserializerArrays(final JsonbDeserializer<?>[]... deserializerArrays);  }
@Test public void testEventsEqual() { final UUID uuidA = UUID.randomUUID(); final UUID uuidB = UUID.randomUUID(); final CommonEvent eventA = new SimpleCommonEvent(new EventId(uuidA), new TypeName("A"), "a"); final CommonEvent eventB = new SimpleCommonEvent(new EventId(uuidB), new TypeName("B"), "b"); final CommonEvent eventAa = new SimpleCommonEvent(new EventId(uuidA), new TypeName("Aa"), "aa"); assertThat(EscSpiUtils.eventsEqual(null, null)).isTrue(); assertThat(EscSpiUtils.eventsEqual(null, new ArrayList<>())).isFalse(); assertThat(EscSpiUtils.eventsEqual(new ArrayList<>(), null)).isFalse(); assertThat(EscSpiUtils.eventsEqual(new ArrayList<>(), new ArrayList<>())).isTrue(); assertThat(EscSpiUtils.eventsEqual(asList(eventA), asList(eventA))).isTrue(); assertThat(EscSpiUtils.eventsEqual(asList(eventA), asList(eventB))).isFalse(); assertThat(EscSpiUtils.eventsEqual(asList(eventB), asList(eventA))).isFalse(); assertThat(EscSpiUtils.eventsEqual(asList(eventA), asList(eventAa))).isTrue(); assertThat(EscSpiUtils.eventsEqual(asList(eventA), asList(eventA, eventB))).isFalse(); assertThat(EscSpiUtils.eventsEqual(asList(eventA, eventB), asList(eventB))).isFalse(); }