/*
 * Copyright 2017, TeamDev Ltd. 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.gradle.compiler.lookup.enrichments;

import org.hamcrest.BaseMatcher;
import org.hamcrest.Description;
import org.junit.BeforeClass;
import org.junit.Test;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

import static org.junit.Assert.assertFalse;

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

    private static final Properties prop = new Properties();

    @BeforeClass
    public static void setUp() {
        try {
            // Get the properties file generated by the plugin
            final File propFile = new File("generated/test/resources/enrichments.properties");
            InputStream input = new FileInputStream(propFile);
            prop.load(input);
            input.close();
        } catch (IOException e) {
            throw new IllegalStateException(e);
        }
    }

    @Test
    public void find_enrichments() {
        assertFalse(prop.isEmpty());
    }

    private static class IsContainedIn extends BaseMatcher<String> {

        private final String container;
        private String item;

        private IsContainedIn(String container) {
            this.container = container;
        }

        @Override
        public boolean matches(Object item) {
            final String value = (String) item;
            this.item = value;
            final boolean result = container.contains(value);
            return result;
        }

        @Override
        public void describeTo(Description description) {
            description.appendText(" given string does not contain ")
                       .appendText(item);
        }
    }
}

@@ -1068,74 +1068,8 @@
 s;%0A%0A
-import org.hamcrest.BaseMatcher;%0Aimport org.hamcrest.Description;%0A
 impo
@@ -1979,696 +1979,7 @@
    %7D
-%0A%0A    private static class IsContainedIn extends BaseMatcher%3CString%3E %7B%0A%0A        private final String container;%0A        private String item;%0A%0A        private IsContainedIn(String container) %7B%0A            this.container = container;%0A        %7D%0A%0A        @Override%0A        public boolean matches(Object item) %7B%0A            final String value = (String) item;%0A            this.item = value;%0A            final boolean result = container.contains(value);%0A            return result;%0A        %7D%0A%0A        @Override%0A        public void describeTo(Description description) %7B%0A            description.appendText(%22 given string does not contain %22)%0A                       .appendText(item);%0A        %7D%0A    %7D
 %0A%7D%0A

Remove unused code