@@ -0,0 +1,3197 @@
+/*%0A * Copyright 2019, TeamDev. All rights reserved.%0A *%0A * Redistribution and use in source and/or binary forms, with or without%0A * modification, must retain the above copyright notice and the following%0A * disclaimer.%0A *%0A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS%0A * %22AS IS%22 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT%0A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR%0A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT%0A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,%0A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT%0A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,%0A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY%0A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT%0A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE%0A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.%0A */%0A%0Apackage io.spine.server.event.store;%0A%0Aimport com.google.common.collect.ImmutableList;%0Aimport com.google.protobuf.Timestamp;%0Aimport io.spine.core.Event;%0Aimport io.spine.grpc.MemoizingObserver;%0Aimport io.spine.server.BoundedContextBuilder;%0Aimport io.spine.server.event.EventStore;%0Aimport io.spine.server.event.EventStreamQuery;%0Aimport org.junit.jupiter.api.DisplayName;%0Aimport org.junit.jupiter.api.Test;%0A%0Aimport static com.google.common.truth.Truth.assertThat;%0Aimport static io.spine.grpc.StreamObservers.memoizingObserver;%0Aimport static org.junit.jupiter.api.Assertions.assertFalse;%0Aimport static org.junit.jupiter.api.Assertions.assertTrue;%0A%0A@DisplayName(%22EmptyEventStore should%22)%0Aclass EmptyEventStoreTest %7B%0A%0A    @Test%0A    @DisplayName(%22do nothing on append(Event)%22)%0A    void notAppend() %7B%0A        EventStore store = new EmptyEventStore();%0A        store.append(Event.getDefaultInstance());%0A        assertEmpty(store);%0A    %7D%0A%0A    @Test%0A    @DisplayName(%22do nothing on appendAll(Iterable%3CEvent%3E)%22)%0A    void notAppendAll() %7B%0A        EventStore store = new EmptyEventStore();%0A        store.appendAll(ImmutableList.of(Event.getDefaultInstance()));%0A        assertEmpty(store);%0A    %7D%0A%0A    @Test%0A    @DisplayName(%22be open and close%22)%0A    void beOpen() throws Exception %7B%0A        EventStore eventStore = new EmptyEventStore();%0A        assertTrue(eventStore.isOpen());%0A        eventStore.close();%0A        assertFalse(eventStore.isOpen());%0A    %7D%0A%0A    @Test%0A    @DisplayName(%22register with a context%22)%0A    void register() %7B%0A        EventStore eventStore = new EmptyEventStore();%0A        assertFalse(eventStore.isRegistered());%0A        eventStore.registerWith(BoundedContextBuilder.assumingTests().build());%0A        assertTrue(eventStore.isRegistered());%0A    %7D%0A%0A    private static void assertEmpty(EventStore store) %7B%0A        EventStreamQuery query = EventStreamQuery%0A                .newBuilder()%0A                .setAfter(Timestamp.getDefaultInstance())%0A                .buildPartial();%0A        MemoizingObserver%3CEvent%3E observer = memoizingObserver();%0A        store.read(query, observer);%0A        assertTrue(observer.isCompleted());%0A        assertThat(observer.responses()).isEmpty();%0A    %7D%0A%7D%0A

Add tests for `EmptyEventStore`