/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.tika.parser.sentiment.analysis;

import org.apache.tika.Tika;
import org.apache.tika.config.TikaConfig;
import org.apache.tika.metadata.Metadata;
import org.junit.Test;

import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.nio.charset.Charset;

import static org.junit.Assert.*;

/**
 * Test case for {@link SentimentParser}
 */
public class SentimentParserTest {

    @Test
    public void endToEndTest() throws Exception {

        Tika tika;
        try (InputStream confStream = getClass().getResourceAsStream("tika-config-sentiment-opennlp.xml")) {
            assert confStream != null;
            TikaConfig config = new TikaConfig(confStream);
            tika = new Tika(config);
        }
        String text = "What a wonderful thought it is that" +
                " some of the best days of our lives haven't happened yet.";
        ByteArrayInputStream stream = new ByteArrayInputStream(text.getBytes(Charset.defaultCharset()));
        Metadata md = new Metadata();
        tika.parse(stream, md);
        String sentiment = md.get("Sentiment");
        assertNotNull(sentiment);
        assertEquals(sentiment, "positive");

    }
}
@@ -1986,9 +1986,702 @@
 %0A%0A    %7D%0A
+%0A   @Test%0A   public void testCategorical() throws Exception%7B%0A       Tika tika;%0A       try (InputStream confStream = getClass().getResourceAsStream(%22tika-config-sentiment-opennlp-cat.xml%22)) %7B%0A%09       assert confStream != null;%0A%09       TikaConfig config = new TikaConfig(confStream);%0A%09       tika = new Tika(config);%0A%09   %7D%0A%0A        String text = %22Whatever, I need some cooling off time!%22;%0A        ByteArrayInputStream stream = new ByteArrayInputStream(text.getBytes(Charset.defaultCharset()));%0A        Metadata md = new Metadata();%0A        tika.parse(stream, md);%0A        String sentiment = md.get(%22Sentiment%22);%0A        assertNotNull(sentiment);%0A        assertEquals(sentiment, %22angry%22);%0A    %7D%0A%0A
 %7D

Add categorical test.