package com.alexrnl.subtitlecorrector.correctionstrategy;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import static org.mockito.MockitoAnnotations.initMocks;

import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.mockito.Mock;

import com.alexrnl.subtitlecorrector.common.Subtitle;
import com.alexrnl.subtitlecorrector.service.DictionaryManager;
import com.alexrnl.subtitlecorrector.service.UserPrompt;

/**
 * Test suite for the {@link CheckSpelling} class.
 * @author Alex
 */
public class CheckSpellingTest {
	/** The strategy to test */
	private CheckSpelling		checkSpelling;
	/** The dictionary manager used */
	@Mock
	private DictionaryManager	dictionary;
	/** The user prompt used */
	@Mock
	private UserPrompt			prompt;
	
	/**
	 * Set up test attributes.
	 */
	@Before
	public void setUp () {
		initMocks(this);
		checkSpelling = new CheckSpelling(dictionary, prompt);
	}
	
	/**
	 * Test method for {@link CheckSpelling#getTranslationKey()}.
	 */
	@Test
	public void testGetTranslationKey () {
		assertEquals("subtitlecorrector.strategy.checkspelling", checkSpelling.getTranslationKey());
	}
	
	/**
	 * Test method for {@link CheckSpelling#getDescription()}.
	 */
	@Test
	public void testGetDescription () {
		assertEquals("subtitlecorrector.strategy.checkspelling.description", checkSpelling.getDescription());
	}
	
	/**
	 * Test method for {@link CheckSpelling#correct(Subtitle)}.
	 */
	@Test @Ignore
	public void testCorrect () {
		fail("Not yet implemented"); // TODO
	}
}

@@ -134,16 +134,225 @@
 t.fail;%0A
+import static org.mockito.Matchers.anyString;%0Aimport static org.mockito.Mockito.mock;%0Aimport static org.mockito.Mockito.never;%0Aimport static org.mockito.Mockito.verify;%0Aimport static org.mockito.Mockito.when;%0A
 import s
@@ -1754,10 +1754,343 @@
 TODO%0A%09%7D%0A
+%09%0A%09/**%0A%09 * Test method for %7B@link CheckSpelling#correct(Subtitle)%7D with an empty subtitle.%0A%09 */%0A%09@Test%0A%09public void testCorrectEmptySubtitle () %7B%0A%09%09final Subtitle subtitle = mock(Subtitle.class);%0A%09%09when(subtitle.getContent()).thenReturn(%22%22);%0A%09%09checkSpelling.correct(subtitle);%0A%09%09verify(subtitle, never()).setContent(anyString());%0A%09%7D%0A
 %7D%0A

Add test for empty subtitles