Add comment. Add test.

This commit is contained in:
Christian P. MOMON 2014-02-23 10:38:36 +01:00
parent c8028369fe
commit 2e85a0cee8
2 changed files with 53 additions and 0 deletions

View file

@ -138,6 +138,13 @@ public class FileTools
/** /**
* Get the extension of a file. * Get the extension of a file.
* *
* <ul>
* <li>getExtension(null) = null</li>
* <li>getExtension("") = null</li>
* <li>getExtension("abc") = null</li>
* <li>getExtension("abc.efg") = "efg"</li>
* </ul>
*
* @param file * @param file
* Source. * Source.
* *

View file

@ -0,0 +1,46 @@
package fr.devinsy.util;
import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
/**
*
* @author Christian P. Momon
*/
public class FileToolsTest
{
static protected org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(FileToolsTest.class);
/**
*
*/
@Before
public void before()
{
BasicConfigurator.configure();
Logger.getRootLogger().setLevel(Level.ERROR);
}
/**
*
*/
@Test
public void testGetExtension()
{
//
logger.debug("===== test starting...");
//
String extension = FileTools.getExtension("test.ext");
//
Assert.assertEquals(extension, "ext");
//
logger.debug("===== test done.");
}
}