/*
 * Copyright 2015 Hewlett-Packard Development Company, L.P.
 * Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License.
 */

package com.hp.autonomy.iod.client.api.textanalysis;

import com.hp.autonomy.iod.client.AbstractIodClientIntegrationTest;
import org.junit.Before;
import org.junit.Test;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.collection.IsCollectionWithSize.hasSize;
import static org.hamcrest.core.Is.is;

public class SentimentAnalysisServiceITCase extends AbstractIodClientIntegrationTest {

    private SentimentAnalysisService sentimentAnalysisService;

    @Override
    @Before
    public void setUp() {
        super.setUp();

        sentimentAnalysisService = getRestAdapter().create(SentimentAnalysisService.class);
    }

    @Test
    public void testSentimentAnalysisForText() {
        final String text = "The service at the restaurant was good. " +
                "The food at the restaurant was poor. " +
                "In conclusion, it was an average restaurant";

        final SentimentAnalysisResponse response = sentimentAnalysisService.analyzeSentimentForText(getApiKey(), text, SentimentAnalysisLanguage.eng);

        assertThat(response.getPositive(), hasSize(1));
        assertThat(response.getNegative(), hasSize(1));

        final SentimentAnalysisAggregate aggregate = response.getAggregate();

        assertThat(aggregate.getSentiment(), is(Sentiment.neutral));

        final SentimentAnalysisEntity positive = response.getPositive().get(0);

        assertThat(positive.getSentiment(), is("good"));
        assertThat(positive.getTopic(), is("The service at the restaurant"));

        final SentimentAnalysisEntity negative = response.getNegative().get(0);

        assertThat(negative.getSentiment(), is("poor"));
        assertThat(negative.getTopic(), is("The food at the restaurant"));
    }

}

@@ -310,47 +310,164 @@
 ort 
-org.junit.Before;%0Aimport org.junit.Test
+com.hp.autonomy.iod.client.Endpoint;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.junit.runners.Parameterized
 ;%0A%0Ai
@@ -626,16 +626,46 @@
 Is.is;%0A%0A
+@RunWith(Parameterized.class)%0A
 public c
@@ -744,16 +744,53 @@
 Test %7B%0A%0A
+    private final Endpoint endpoint;%0A
     priv
@@ -853,17 +853,113 @@
     
-@Override
+public SentimentAnalysisServiceITCase(final Endpoint endpoint) %7B%0A        this.endpoint = endpoint;%0A    %7D%0A
 %0A   
@@ -1013,16 +1013,24 @@
 r.setUp(
+endpoint
 );%0A%0A    
@@ -1478,16 +1478,25 @@
 ForText(
+endpoint.
 getApiKe

Update test for new specification.