diff options
Diffstat (limited to 'org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/AttachmentSizeFormatterTest.java')
-rw-r--r-- | org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/AttachmentSizeFormatterTest.java | 76 |
1 files changed, 0 insertions, 76 deletions
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/AttachmentSizeFormatterTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/AttachmentSizeFormatterTest.java deleted file mode 100644 index 0a4cf1b65..000000000 --- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/AttachmentSizeFormatterTest.java +++ /dev/null @@ -1,76 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2008 Willian Mitsuda and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Willian Mitsuda - initial API and implementation - * Frank Becker - improvements - *******************************************************************************/ - -package org.eclipse.mylyn.tasks.tests; - -import java.util.Locale; - -import junit.framework.TestCase; - -import org.eclipse.mylyn.internal.tasks.ui.editors.AttachmentSizeFormatter; - -/** - * Tests attachment size value formatting. - * - * @author Willian Mitsuda - * @author Frank Becker - */ -public class AttachmentSizeFormatterTest extends TestCase { - - public void testInvalidString() { - AttachmentSizeFormatter formatter = AttachmentSizeFormatter.getInstance(); - assertEquals(AttachmentSizeFormatter.UNKNOWN_SIZE, formatter.format(null)); - assertEquals(AttachmentSizeFormatter.UNKNOWN_SIZE, formatter.format("x")); - } - - public void testNotAValidNumber() { - AttachmentSizeFormatter formatter = AttachmentSizeFormatter.getInstance(); - assertEquals(AttachmentSizeFormatter.UNKNOWN_SIZE, formatter.format("-5")); - assertEquals(AttachmentSizeFormatter.UNKNOWN_SIZE, formatter.format("1.0")); - } - - public void testByteFormatter() { - AttachmentSizeFormatter formatter = new AttachmentSizeFormatter(Locale.ENGLISH); - assertEquals("1 byte", formatter.format("1")); - assertEquals("2 bytes", formatter.format("2")); - assertEquals("1023 bytes", formatter.format("1023")); - } - - public void testKBFormatter() { - AttachmentSizeFormatter formatterEnglish = new AttachmentSizeFormatter(Locale.ENGLISH); - assertEquals("1.00 KB", formatterEnglish.format("1024")); - assertEquals("1024.00 KB", formatterEnglish.format("1048575")); - - AttachmentSizeFormatter formatterGerman = new AttachmentSizeFormatter(Locale.GERMAN); - assertEquals("1,00 KB", formatterGerman.format("1024")); - assertEquals("1024,00 KB", formatterGerman.format("1048575")); - } - - public void testMBFormatter() { - AttachmentSizeFormatter formatterEnglish = new AttachmentSizeFormatter(Locale.ENGLISH); - assertEquals("1.00 MB", formatterEnglish.format("1048576")); - assertEquals("1024.00 MB", formatterEnglish.format("1073741823")); - - AttachmentSizeFormatter formatterGerman = new AttachmentSizeFormatter(Locale.GERMAN); - assertEquals("1,00 MB", formatterGerman.format("1048576")); - assertEquals("1024,00 MB", formatterGerman.format("1073741823")); - } - - public void testGBFormatter() { - AttachmentSizeFormatter formatterEnglish = new AttachmentSizeFormatter(Locale.ENGLISH); - assertEquals("1.00 GB", formatterEnglish.format("1073741824")); - - AttachmentSizeFormatter formatterGerman = new AttachmentSizeFormatter(Locale.GERMAN); - assertEquals("1,00 GB", formatterGerman.format("1073741824")); - } - -} |