/*
 * Copyright 2018, TeamDev. All rights reserved.
 *
 * Redistribution and use in source and/or binary forms, with or without
 * modification, must retain the above copyright notice and the following
 * disclaimer.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

package io.spine.server.delivery.given;

import com.google.protobuf.Empty;
import io.spine.core.Subscribe;
import io.spine.server.delivery.SystemEventWatcher;
import io.spine.system.server.EntityCreated;
import io.spine.type.TypeUrl;
import spine.test.delivery.SewProjectCraeted;

import static org.junit.jupiter.api.Assertions.fail;

/**
 * @author Dmytro Dashenkov
 */
public class SystemEventWatcherTestEnv {

    /**
     * Prevents the utility class instantiation.
     */
    private SystemEventWatcherTestEnv() {
    }

    public static class DomesticWatcher extends SystemEventWatcher<String> {

        public DomesticWatcher() {
            super(TypeUrl.of(Empty.class));
        }

        @Subscribe
        public void on(SewProjectCraeted domesticEvent) {
            fail("Domestic events are not allowed in SystemEventWatchers.");
        }
    }

    public static class ExternalNonSystemWatcher extends SystemEventWatcher<String> {

        public ExternalNonSystemWatcher() {
            super(TypeUrl.of(Empty.class));
        }

        @Subscribe(external = true)
        public void on(SewProjectCraeted externalEvent) {
            fail("Only spine.system.server events are allowed.");
        }
    }

    public static class ExternalSystemWatcher extends SystemEventWatcher<String> {

        public ExternalSystemWatcher() {
            super(TypeUrl.of(Empty.class));
        }

        @Subscribe(external = true)
        public void on(EntityCreated externalEvent) {
            // NoOp.
        }
    }
}

/*
 * Copyright 2018, TeamDev. All rights reserved.
 *
 * Redistribution and use in source and/or binary forms, with or without
 * modification, must retain the above copyright notice and the following
 * disclaimer.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

package io.spine.server.delivery.given;

import com.google.protobuf.Empty;
import io.spine.core.Subscribe;
import io.spine.server.delivery.SystemEventWatcher;
import io.spine.system.server.EntityCreated;
import io.spine.test.delivery.SewProjectCraeted;
import io.spine.type.TypeUrl;

import static org.junit.jupiter.api.Assertions.fail;

/**
 * @author Dmytro Dashenkov
 */
public class SystemEventWatcherTestEnv {

    /**
     * Prevents the utility class instantiation.
     */
    private SystemEventWatcherTestEnv() {
    }

    public static class DomesticWatcher extends SystemEventWatcher<String> {

        public DomesticWatcher() {
            super(TypeUrl.of(Empty.class));
        }

        @Subscribe
        public void on(SewProjectCraeted domesticEvent) {
            fail("Domestic events are not allowed in SystemEventWatchers.");
        }
    }

    public static class ExternalNonSystemWatcher extends SystemEventWatcher<String> {

        public ExternalNonSystemWatcher() {
            super(TypeUrl.of(Empty.class));
        }

        @Subscribe(external = true)
        public void on(SewProjectCraeted externalEvent) {
            fail("Only spine.system.server events are allowed.");
        }
    }

    public static class ExternalSystemWatcher extends SystemEventWatcher<String> {

        public ExternalSystemWatcher() {
            super(TypeUrl.of(Empty.class));
        }

        @Subscribe(external = true)
        public void on(EntityCreated externalEvent) {
            // NoOp.
        }
    }
}

Fix an import.