package com.alexrnl.commons.io;

import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

import java.io.BufferedReader;
import java.io.EOFException;
import java.io.IOException;
import java.net.URISyntaxException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;

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

/**
 * Test suite for the {@link IOUtils} class.
 * @author Alex
 */
public class IOUtilsTest {
	
	/**
	 * Set up test attributes.
	 */
	@Before
	public void setUp () {
	}
	
	/**
	 * Test method for {@link com.alexrnl.commons.io.IOUtils#readLine(java.io.BufferedReader)}.
	 * @throws URISyntaxException
	 *         if the path to the test file is not correct.
	 * @throws IOException
	 *         if there was an issue while reading the file.
	 */
	@Test
	public void testReadLine () throws IOException, URISyntaxException {
		final BufferedReader reader = Files.newBufferedReader(
				Paths.get(getClass().getResource("/configuration.properties").toURI()),
				StandardCharsets.UTF_8);
		assertNotNull(IOUtils.readLine(reader));
		assertNotNull(IOUtils.readLine(reader));
		boolean eof = false;
		try {
			IOUtils.readLine(reader);
		} catch (final EOFException e) {
			eof = true;
		} finally {
			assertTrue(eof);
		}
	}

	/**
	 * Test method for {@link com.alexrnl.commons.io.IOUtils#readLine(java.io.BufferedReader)}.
	 * @throws IOException
	 *         if there was an issue while reading the file.
	 */
	@Test(expected = NullPointerException.class)
	public void testReadLineNullPointerException () throws IOException {
		IOUtils.readLine(null);
	}
	
}

@@ -26,16 +26,61 @@
 ns.io;%0A%0A
+import static org.junit.Assert.assertEquals;%0A
 import s
@@ -1689,10 +1689,706 @@
 );%0A%09%7D%0A%09%0A
+%09/**%0A%09 * Test method for %7B@link com.alexrnl.commons.io.IOUtils#getFilename(java.nio.file.Path)%7D.%0A%09 */%0A%09@Test%0A%09public void testGetFilename () %7B%0A%09%09assertEquals(%22hello%22, IOUtils.getFilename(Paths.get(%22serv%22, %22io%22, %22hello.txt%22)));%0A%09%09assertEquals(%22hello%22, IOUtils.getFilename(Paths.get(%22io%22, %22hello%22)));%0A%09%09assertEquals(%22hel.lo%22, IOUtils.getFilename(Paths.get(%22serv%22, %22hel.lo.txt%22)));%0A%09%09assertEquals(%22.classpath%22, IOUtils.getFilename(Paths.get(%22.classpath%22)));%0A%09%7D%0A%09%0A%09/**%0A%09 * Test method for %7B@link com.alexrnl.commons.io.IOUtils#getFilename(java.nio.file.Path)%7D.%0A%09 */%0A%09@Test(expected = NullPointerException.class)%0A%09public void testGetFilenameNullPointerException () %7B%0A%09%09IOUtils.getFilename(null);%0A%09%7D%0A%09%0A
 %7D%0A

Add tests for the getFilename method