Add comment. Add test.
This commit is contained in:
parent
c8028369fe
commit
2e85a0cee8
2 changed files with 53 additions and 0 deletions
|
@ -138,6 +138,13 @@ public class FileTools
|
|||
/**
|
||||
* 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
|
||||
* Source.
|
||||
*
|
||||
|
|
46
test/fr/devinsy/util/FileToolsTest.java
Normal file
46
test/fr/devinsy/util/FileToolsTest.java
Normal 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.");
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue