mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-14 20:42:21 +00:00
Fixed wrong camel casing and simplified dealing with locale
This commit is contained in:
1 parent
6437fe2e78
commit
4bf431cfaf
1 file changed
+16
-14
@@ -23,8 +23,7 @@
|
||||
*/
|
||||
package hudson;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.DecimalFormatSymbols;
|
||||
import java.util.Locale;
|
||||
|
||||
import hudson.model.Action;
|
||||
import static org.junit.Assert.*;
|
||||
@@ -123,18 +122,21 @@ public class FunctionsTest {
|
||||
|
||||
@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));
|
||||
public void testHumanReadableFileSize(){
|
||||
Locale defaultLocale = Locale.getDefault();
|
||||
try{
|
||||
Locale.setDefault(Locale.ENGLISH);
|
||||
assertEquals("0 B", Functions.humanReadableByteSize(0));
|
||||
assertEquals("1023 B", Functions.humanReadableByteSize(1023));
|
||||
assertEquals("1.00 KB", Functions.humanReadableByteSize(1024));
|
||||
assertEquals("1.50 KB", Functions.humanReadableByteSize(1536));
|
||||
assertEquals("20.00 KB", Functions.humanReadableByteSize(20480));
|
||||
assertEquals("1023.00 KB", Functions.humanReadableByteSize(1047552));
|
||||
assertEquals("1.00 MB", Functions.humanReadableByteSize(1048576));
|
||||
assertEquals("1.50 GB", Functions.humanReadableByteSize(1610612700));
|
||||
}finally{
|
||||
Locale.setDefault(defaultLocale);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user