package com.admios.connector.watsonalchemylanguage.automation.functional;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

import org.junit.Test;
import org.mule.tools.devkit.ctf.junit.AbstractTestCase;

import com.admios.connector.watsonalchemylanguage.WatsonAlchemyLanguageConnector;
import com.ibm.watson.developer_cloud.alchemy.v1.model.SAORelations;

public class RelationsTestCase extends AbstractTestCase<WatsonAlchemyLanguageConnector> {

	public RelationsTestCase() {
		super(WatsonAlchemyLanguageConnector.class);
	}

	@Test
	public void relationTestUsingURL() {

		String url = "http://www.admios.com/admios-blog/2016/7/20/build-fast-and-clean-uis-with-angular-material";
		SAORelations relations = getConnector().relations(url, 4, null, null, null, null, null, null, null, null, null,
				null, null, null, null);

		assertNotNull(relations);
		assertEquals("english", relations.getLanguage());
		assertEquals(url, relations.getUrl());
		assertEquals(4, relations.getRelations().size());
		assertEquals("Angular.js", relations.getRelations().get(0).getSubject().getText());
	}

	@Test
	public void relationTestUsingText() {

		String text = "Angular.js has been out there for a while now and is definitely a popular option to take into"
				+ " consideration when selecting a front end technology.";
		SAORelations relations = getConnector().relations(text, 10, true, null, null, null, null, true, null, null, null,
				null, null, null, null);

		assertNotNull(relations);
		assertEquals("english", relations.getLanguage());
		assertEquals(text + "\n", relations.getText());
		assertEquals(3, relations.getRelations().size());
		assertEquals("Angular.js", relations.getRelations().get(0).getSubject().getText());
		assertTrue(relations.getUrl().isEmpty());
	}
}

@@ -1484,22 +1484,16 @@
 , null, 
-true, 
 null, nu
@@ -1486,32 +1486,737 @@
 null, null, null
+, null, null,%0A%09%09%09%09null, null, null, null);%0A%0A%09%09assertNotNull(relations);%0A%09%09assertEquals(%22english%22, relations.getLanguage());%0A%09%09assertEquals(text + %22%5Cn%22, relations.getText());%0A%09%09assertEquals(3, relations.getRelations().size());%0A%09%09assertEquals(%22Angular.js%22, relations.getRelations().get(0).getSubject().getText());%0A%09%09assertTrue(relations.getUrl().isEmpty());%0A%09%7D%0A%09%0A%09@Test%0A%09public void relationTestUsingTextAndDisambiguate() %7B%0A%09%09String text = %22Angular.js has been out there for a while now and is definitely a popular option to take into%22%0A%09%09%09%09+ %22 consideration when selecting a front end technology.%22;%0A%09%09SAORelations relations = getConnector().relations(text, 10, true, null, null, null, null, true, null, true
 , null,%0A%09%09%09%09null

Add test to check the cast of false-0 options.