Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* fix issue JENKINS-8781
git-svn-id: https://svn.jenkins-ci.org/trunk/hudson/plugins/thinBackup@38689 71c3de6d-444a-0410-be80-ed276b4c234a
- Loading branch information
1 parent
95ea764
commit f51b095
Showing
4 changed files
with
65 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/test/java/org/jvnet/hudson/plugins/thinbackup/utils/TestUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package org.jvnet.hudson.plugins.thinbackup.utils; | ||
|
||
import java.text.ParseException; | ||
|
||
import junit.framework.Assert; | ||
|
||
import org.junit.Test; | ||
|
||
public class TestUtils { | ||
|
||
@Test | ||
public void testConvertToDirectoryNameDateFormat() throws ParseException { | ||
String displayDate = "2011-02-13 10:48"; | ||
String fileDate = Utils.convertToDirectoryNameDateFormat(displayDate); | ||
Assert.assertEquals("2011-02-13_10-48", fileDate); | ||
} | ||
|
||
@Test(expected = ParseException.class) | ||
public void testBadFormatConvertToDirectoryNameDateFormat() throws ParseException { | ||
String displayDate = "2011-02-13-10:48"; | ||
Utils.convertToDirectoryNameDateFormat(displayDate); | ||
} | ||
|
||
@Test(expected = ParseException.class) | ||
public void testWrongFormatConvertToDirectoryNameDateFormat() throws ParseException { | ||
String displayDate = "FULL-2011-02-13_10-48"; | ||
Utils.convertToDirectoryNameDateFormat(displayDate); | ||
} | ||
|
||
@Test(expected = ParseException.class) | ||
public void testEmptyDateConvertToDirectoryNameDateFormat() throws ParseException { | ||
Utils.convertToDirectoryNameDateFormat(""); | ||
} | ||
} |