package edu.fiu.jtlex.data;

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

import org.junit.jupiter.api.Test;

import edu.fiu.jtlex.data.IEvent.EventClass;
import edu.fiu.jtlex.data.IInstance.Aspect;
import edu.fiu.jtlex.data.IInstance.Polarity;
import edu.fiu.jtlex.data.IInstance.Pos;
import edu.fiu.jtlex.data.IInstance.Tense;

/**
 * A class that contains tests for the Instance class 
 * @author arada002
 *
 */
class InstanceTest {
	
	private final IEvent event = new Event(1, EventClass.ASPECTUAL, "word");
	private final ISignal signal = new Signal(1, "on");

	@Test
	void testConstructor() {
		new Instance(1, event, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE,
				Polarity.NEG, "word", signal, "1");
	}
	
	@Test
	void testInvalidID() {
		assertThrows(IllegalArgumentException.class, ()-> new Instance(0, event, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE,
				Polarity.NEG, "word", signal, "1"));
	}
	
	@Test
	void testEventNull() {
		assertThrows(NullPointerException.class, ()-> new Instance(1, null, Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE,
				Polarity.NEG, "word", signal, "1"));
	}
	
	@Test
	void testTenseNull() {
		assertThrows(NullPointerException.class, ()-> new Instance(1, event, null, Aspect.NONE, Pos.ADJECTIVE,
				Polarity.NEG, "word", signal, "1"));
	}
	
	@Test
	void testAspectNull() {
		assertThrows(NullPointerException.class, ()-> new Instance(1, event,Tense.FUTURE, null, Pos.ADJECTIVE,
				Polarity.NEG, "word", signal, "1"));
	}
	
	@Test
	void testPosNull() {
		assertThrows(NullPointerException.class, ()-> new Instance(1, event,Tense.FUTURE, Aspect.NONE, null,
				Polarity.NEG, "word", signal, "1"));
	}
	
	@Test
	void testPolarityNull() {
		assertThrows(NullPointerException.class, ()-> new Instance(1, event,Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE,
				null, "word", signal, "1"));
	}
	
	@Test
	void testModalityEmpty() {
		assertThrows(IllegalArgumentException.class, ()-> new Instance(1, event,Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE,
				Polarity.NEG, "", signal, "1"));
	}
	
	@Test
	void testModalityWhitespace() {
		assertThrows(IllegalArgumentException.class, ()-> new Instance(1, event,Tense.FUTURE, Aspect.NONE, Pos.ADJECTIVE,
				Polarity.NEG, "         ", signal, "1"));
	}
	
	
}
