import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.is;

import java.io.IOException;
import java.util.List;

import org.junit.BeforeClass;
import org.junit.Test;

public class TextBuddyTest {
	
	private static final String FILE_NAME = "mytextfile.txt";

	@BeforeClass
	public static void initialize() throws IOException {
		TextBuddy tb = new TextBuddy(FILE_NAME);
		tb.checkFileStatus();
	}

	@Test
	public void testSortEmpty() {
		TextBuddy.clearText();
		
		List<String> list = TextBuddy.sortText();
		assertThat(list.isEmpty(), is(true));
	}
	
	@Test
	public void testSort() {
		TextBuddy.addText("cccc");
		TextBuddy.addText("aaaa");
		TextBuddy.addText("bbbb");
		
		List<String> list = TextBuddy.sortText();
		
		// Not empty.
		assertThat(list.isEmpty(), is(false));
		
		// Check sorted.
		assertEquals("[aaaa, bbbb, cccc]", list.toString());
	}

}

import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.is;

import java.io.IOException;
import java.util.List;

import org.junit.BeforeClass;
import org.junit.Test;

public class TextBuddyTest {
	
	private static final String FILE_NAME = "mytextfile.txt";

	@BeforeClass
	public static void initialize() throws IOException {
		TextBuddy tb = new TextBuddy(FILE_NAME);
		tb.checkFileStatus();
	}

	@Test
	public void testSortEmpty() {
		TextBuddy.clearText();
		
		List<String> list = TextBuddy.sortText();
		assertThat(list.isEmpty(), is(true));
	}
	
	@Test
	public void testSort1() {
		TextBuddy.clearText();
		
		TextBuddy.addText("cccc");
		TextBuddy.addText("aaaa");
		TextBuddy.addText("bbbb");
		
		List<String> list = TextBuddy.sortText();
		
		// Not empty.
		assertThat(list.isEmpty(), is(false));
		
		// Check sorted.
		assertEquals("[aaaa, bbbb, cccc]", list.toString());
	}
	
	@Test
	public void testSort2() {
		TextBuddy.clearText();
	
		TextBuddy.addText("CCCC");
		TextBuddy.addText("aaaa");
		TextBuddy.addText("xxxx");
		
		List<String> list = TextBuddy.sortText();
		
		// Not empty.
		assertThat(list.isEmpty(), is(false));
		
		// Check sorted.
		assertEquals("[aaaa, CCCC, xxxx]", list.toString());
	}

}

Test case with uppercase and lowercase combination.
Test case with uppercase and lowercase combination.
