mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-14 20:42:21 +00:00
Unit test for JENKINS-16630
This commit is contained in:
1 parent
f19f772322
commit
6437fe2e78
1 file changed
+20
@@ -23,6 +23,9 @@
|
||||
*/
|
||||
package hudson;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.DecimalFormatSymbols;
|
||||
|
||||
import hudson.model.Action;
|
||||
import static org.junit.Assert.*;
|
||||
import org.junit.Test;
|
||||
@@ -117,4 +120,21 @@ public class FunctionsTest {
|
||||
when(req.getContextPath()).thenReturn(contextPath);
|
||||
return req;
|
||||
}
|
||||
|
||||
@Test
|
||||
@Bug(16630)
|
||||
public void testhumanReadableFileSize(){
|
||||
DecimalFormat format = (DecimalFormat) DecimalFormat.getInstance();
|
||||
DecimalFormatSymbols symbols = format.getDecimalFormatSymbols();
|
||||
char sep = symbols.getDecimalSeparator();
|
||||
assertEquals("0 B", Functions.humanReadableByteSize(0));
|
||||
assertEquals("1023 B", Functions.humanReadableByteSize(1023));
|
||||
assertEquals("1"+sep+"00 KB", Functions.humanReadableByteSize(1024));
|
||||
assertEquals("1"+sep+"50 KB", Functions.humanReadableByteSize(1536));
|
||||
assertEquals("20"+sep+"00 KB", Functions.humanReadableByteSize(20480));
|
||||
assertEquals("1023"+sep+"00 KB", Functions.humanReadableByteSize(1047552));
|
||||
assertEquals("1"+sep+"00 MB", Functions.humanReadableByteSize(1048576));
|
||||
assertEquals("1"+sep+"50 GB", Functions.humanReadableByteSize(1610612700));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user