/*
 * National University of Singapore
 * The MIT License (MIT)
 *
 * Copyright (c) 2014. Kenneth Ham Gao Jie (A0111875E)
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

package test;

import com.CS2103.TextBuddy_v2.*;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
import java.io.IOException;

import org.junit.Before;
import org.junit.Test;

public class TextBuddyTest {
	private static final String APP_NAME = "TextBuddy";
	private static final String FILE_NAME = "in.txt";
	private static final String[] ARGS = {APP_NAME, FILE_NAME};
	private TextBuddyPlusPlus textbuddypp = new TextBuddyPlusPlus();

	@Before
	public void initialize() throws IOException {
		TextBuddyPlusPlus textbuddypp = new TextBuddyPlusPlus();
		textbuddypp.TextBuddy(ARGS);
		textbuddypp.processUserCommands();
	}

	// Search Empty
	@Test
	public void testSearchEmpty() throws IOException {
		String output = textbuddypp.executeCommand("search ");
		assertEquals("", textbuddypp.executeCommand("search "));
		assertThat(output.isEmpty(), is(true));
	}
}

@@ -1811,51 +1811,25 @@
 );%0A%09
-%09textbuddypp.processUserCommands();%0A%09%7D%0A%0A%09//
+%7D%0A%0A%09// Test Case:
  Sea
@@ -1901,65 +1901,8 @@
 n %7B%0A
-%09%09String output = textbuddypp.executeCommand(%22search %22);%0A
 %09%09as
@@ -1916,95 +1916,46 @@
 als(
-%22%22, textb
+null, TextB
 uddy
-pp.executeCommand(%22search %22));%0A%09%09assertThat(output.isEmpty(), is(true
+PlusPlus.search(%22%22
 ));%0A%09%7D%0A%7D
 %0A
@@ -1953,9 +1953,8 @@
 ));%0A%09%7D%0A%7D
-%0A

Version 0.1.3: Unit Testing for TextBuddy++. Successfully tested an empty search string case.