package edu.fiu.jtlex.data;

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

import org.junit.jupiter.api.Test;

import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Nested;

import edu.fiu.jtlex.ILinguisticEvent.EventAspect;
import edu.fiu.jtlex.ILinguisticEvent.EventIntent;
import edu.fiu.jtlex.ILinguisticEvent.EventType;
import edu.fiu.jtlex.LinguisticEvent;

public class LinguisticEventTest {
	
	//Test Constructor
	@Nested
	@DisplayName("Testing Constructor")
	class testConstructor{
		/**Test Linguistic ID Test
		 * Test case ID: TestLID()
		 * Purpose: Test Linguistic Constructor ID
		 * Test input: testing = new LinguisticEvent(-1, "lemma", "text", 0, 0, EventType.REPORT, EventIntent.ACHIEVEMENT, EventAspect.INITIATION);
		 * Expected output: error: IllegalArgumentException
		 */
		@Nested
		@DisplayName("if ID is")
		class TestLID{
			@Test
			@DisplayName("negative")
			void testIdNegative() {
				assertThrows(IllegalArgumentException.class, ()-> new LinguisticEvent(-1, "lemma", "text", 0, 0, EventType.REPORT, EventIntent.ACHIEVEMENT, EventAspect.INITIATION,null, null, false,null,null));
			}
		}
		
		/**Test Linguistic Lemma Test
		 * Test case ID: TestLLemma()
		 * Purpose: Test Linguistic Constructor Lemma
		 * Test input: testing = new LinguisticEvent(-1, null, "text", 0, 0, EventType.REPORT, EventIntent.ACHIEVEMENT, EventAspect.INITIATION);
		 * Expected output: error: NullPointerException
		 */
		@Nested
		@DisplayName("if Lemma is")
		class TestLLemma{
			@Test
			@DisplayName("null")
			void testClass() {
				assertThrows(NullPointerException.class, ()-> new LinguisticEvent(0, null, "text", 0, 0, EventType.REPORT, EventIntent.ACHIEVEMENT, EventAspect.INITIATION, null, null, false,null,null));
			}
		}
		
		/**Test Linguistic Text Test
		 * Test case ID: TestLText()
		 * Purpose: Test Linguistic Constructor Text
		 * Test input: testing = new LinguisticEvent(-1, "lemma", null, 0, 0, EventType.REPORT, EventIntent.ACHIEVEMENT, EventAspect.INITIATION);
		 * Expected output: error: NullPointerException
		 */
		@Nested
		@DisplayName("if Text is")
		class TestLText{
			@Test
			@DisplayName("null")
			void testClass() {
				assertThrows(NullPointerException.class, ()-> new LinguisticEvent(0, "lemma", null, 0, 0, EventType.REPORT, EventIntent.ACHIEVEMENT, EventAspect.INITIATION, null, null, false,null,null));
			}
		}
		
		/**Test Linguistic Begin ID Test
		 * Test case ID: TestBegin()
		 * Purpose: Test Linguistic Constructor Begin
		 * Test input: testing = new LinguisticEvent(0, "lemma", "text", -1, 0, EventType.REPORT, EventIntent.ACHIEVEMENT, EventAspect.INITIATION);
		 * Expected output: error: IllegalArgumentException
		 */
		@Nested
		@DisplayName("if Begin is")
		class TestLBegin{
			@Test
			@DisplayName("negative")
			void testIdNegative() {
				assertThrows(IllegalArgumentException.class, ()-> new LinguisticEvent(0, "lemma", "text", -1, 0, EventType.REPORT, EventIntent.ACHIEVEMENT, EventAspect.INITIATION, null, null, false,null,null));
			}
		}
		
		/**Test Linguistic End Id Test Test
		 * Test case ID: TestEnd()
		 * Purpose: Test Linguistic Constructor End
		 * Test input: testing = LinguisticEvent(0, "lemma", "text", 0, -1, EventType.REPORT, EventIntent.ACHIEVEMENT, EventAspect.INITIATION);
		 * Expected output: error: IllegalArgumentException
		 */
		@Nested
		@DisplayName("if End is")
		class TestLEnd{
			@Test
			@DisplayName("negative")
			void testIdNegative() {
				assertThrows(IllegalArgumentException.class, ()-> new LinguisticEvent(0, "lemma", "text", 0, -1, EventType.REPORT, EventIntent.ACHIEVEMENT, EventAspect.INITIATION, null, null, false,null,null));
			}
		}	
	}
	
    //Tests getter methods
	@Nested
	@DisplayName("Testing getters")
	class TestGetters{
		
		/**Test LinguisticEvent id getter test
		 * Test case ID: testGetLinguisticId()
		 * Purpose: Test Linguistic GetId Getter
		 * Test input: testing = new LinguisticEvent(1, "lemma", "text", 2, 3, EventType.REPORT, EventIntent.ACHIEVEMENT, EventAspect.INITIATION);
		 * Expected output: returning int
		 */
		@Test
		@DisplayName("returning int")
		void testGetLinguisticId() {
			LinguisticEvent linguisticEvent = new LinguisticEvent(1, "lemma", "text", 2, 3, EventType.REPORT, EventIntent.ACHIEVEMENT, EventAspect.INITIATION, null, null, false,null,null);
			assertEquals(linguisticEvent.getId(), 1);
		}
		
		/**Test LinguisticEvent lemma getter test
		 * Test case ID: testGetLinguisticLemm()
		 * Purpose: Test Linguistic GetLemma Getter
		 * Test input: testing = new LinguisticEvent(1, "lemma", "text", 2, 3, EventType.REPORT, EventIntent.ACHIEVEMENT, EventAspect.INITIATION);
		 * Expected output: returning string
		 */
		@Test
		@DisplayName("returning string")
		void testGetLinguisticLemma() {
			LinguisticEvent linguisticEvent = new LinguisticEvent(1, "lemma", "text", 2, 3, EventType.REPORT, EventIntent.ACHIEVEMENT, EventAspect.INITIATION, null, null, false,null,null);
			assertEquals(linguisticEvent.getLemma(), "lemma");
			}

		
		/**Test LinguisticEvent lemma getter test
		 * Test case ID: testGetLinguisticText()
		 * Purpose: Test Linguistic GetLemma Getter
		 * Test input: testing = new LinguisticEvent(1, "lemma", "text", 2, 3, EventType.REPORT, EventIntent.ACHIEVEMENT, EventAspect.INITIATION);
		 * Expected output: returning string
		 */
		@Test
		@DisplayName("returning string")
		void testGetLinguisticText() {
			LinguisticEvent linguisticEvent = new LinguisticEvent(1, "lemma", "text", 2, 3, EventType.REPORT, EventIntent.ACHIEVEMENT, EventAspect.INITIATION, null, null, false,null,null);
			assertEquals(linguisticEvent.getText(), "text");
		}
		
		/**Test LinguisticEvent begin getter test
		 * Test case ID: testGetLinguisticBegin()
		 * Purpose: Test Linguistic GetBegin Getter
		 * Test input: testing = new LinguisticEvent(1, "lemma", "text", 2, 3, EventType.REPORT, EventIntent.ACHIEVEMENT, EventAspect.INITIATION);
		 * Expected output: returning int
		 */
		@Test
		@DisplayName("returning int")
		void testGetLinguisticBegin() {
			LinguisticEvent linguisticEvent = new LinguisticEvent(1, "lemma", "text", 2, 3, EventType.REPORT, EventIntent.ACHIEVEMENT, EventAspect.INITIATION, null, null, false,null,null);
			assertEquals(linguisticEvent.getBegin(), 2);
		}
		
		/**Test LinguisticEvent end getter test
		 * Test case ID: testGetLinguisticEnd()
		 * Purpose: Test Linguistic GetEnd Getter
		 * Test input: testing = new LinguisticEvent(1, "lemma", "text", 2, 3, EventType.REPORT, EventIntent.ACHIEVEMENT, EventAspect.INITIATION);
		 * Expected output: returning int
		 */
		@Test
		@DisplayName("returning int")
		void testGetLinguisticEnd() {
			LinguisticEvent linguisticEvent = new LinguisticEvent(1, "lemma", "text", 2, 3, EventType.REPORT, EventIntent.ACHIEVEMENT, EventAspect.INITIATION,null, null, false,null,null);
			assertEquals(linguisticEvent.getEnd(), 3);
		}
		
		/**Test LinguisticEvent EventType getter test
		 * Test case ID: testGetLinguisticEventType()
		 * Purpose: Test Linguistic GetEventType Getter
		 * Test input: testing = new LinguisticEvent(1, "lemma", "text", 2, 3, EventType.REPORT, EventIntent.ACHIEVEMENT, EventAspect.INITIATION);
		 * Expected output: returning EventType
		 */
		@Test
		@DisplayName("returning EventType")
		void testGetLinguisticEventType() {
			LinguisticEvent linguisticEvent = new LinguisticEvent(1, "lemma", "text", 2, 3, EventType.REPORT, EventIntent.ACHIEVEMENT, EventAspect.INITIATION, null, null, false,null,null);
			assertEquals(linguisticEvent.getEventType(), EventType.REPORT);
		}

		
		/**Test LinguisticEvent EventIntent getter test
		 * Test case ID: TestGetEventIntent()
		 * Purpose: Test Linguistic GetEventIntent Getter
		 * Test input: testing = new LinguisticEvent(1, "lemma", "text", 2, 3, EventType.REPORT, EventIntent.ACHIEVEMENT, EventAspect.INITIATION);
		 * Expected output: returning EventIntent
		 */
		@Test
		@DisplayName("returning EventIntent")
		void testLGetLinguisticEventIntent() {
			LinguisticEvent linguisticEvent = new LinguisticEvent(1, "lemma", "text", 2, 3, EventType.REPORT, EventIntent.ACHIEVEMENT, EventAspect.INITIATION,null, null, false,null,null);
			assertEquals(linguisticEvent.getEventIntent(), EventIntent.ACHIEVEMENT);
		}
		
		/**Test LinguisticEvent EventAspect getter test
		 * Test case ID: testGetLinguisticEventAspect()
		 * Purpose: Test Linguistic GetEventAspect Getter
		 * Test input: testing = new LinguisticEvent(1, "lemma", "text", 2, 3, EventType.REPORT, EventIntent.ACHIEVEMENT, EventAspect.INITIATION);
		 * Expected output: returning EventAspect
		 */
		@Test
		@DisplayName("returning EventAspect")
		void testGetLinguisticEventAspect() {
			LinguisticEvent linguisticEvent = new LinguisticEvent(1, "lemma", "text", 2, 3, EventType.REPORT, EventIntent.ACHIEVEMENT, EventAspect.INITIATION,null, null, false,null,null);
			assertEquals(linguisticEvent.getEventAspect(), EventAspect.INITIATION);
		}

	}
}
	

