diff options
author | Dhandapani <dhandapani@gluster.com> | 2011-09-23 12:44:16 +0530 |
---|---|---|
committer | Dhandapani <dhandapani@gluster.com> | 2011-09-23 12:50:56 +0530 |
commit | 2d67428457466d8b41191aa4b102a436d1b6965e (patch) | |
tree | 48289a6e0edd1f172339fb7fa4c9481c26975b6d /src | |
parent | 1fddc61a7cb329379779ee34c86dd1ffb5662862 (diff) | |
parent | 4e56c956f5e8eec6e70156530ab33ad445f6ec79 (diff) |
Merge branch 'work'
Conflicts:
src/com.gluster.storage.management.core/junit/com/gluster/storage/management/core/utils/StringUtilTest.java
Diffstat (limited to 'src')
3 files changed, 23 insertions, 60 deletions
diff --git a/src/com.gluster.storage.management.core/.project b/src/com.gluster.storage.management.core/.project index 6c8fbb5c..c016cd3c 100644 --- a/src/com.gluster.storage.management.core/.project +++ b/src/com.gluster.storage.management.core/.project @@ -20,9 +20,15 @@ <arguments> </arguments> </buildCommand> + <buildCommand> + <name>com.instantiations.assist.eclipse.coverage.instrumentationBuilder</name> + <arguments> + </arguments> + </buildCommand> </buildSpec> <natures> <nature>org.eclipse.pde.PluginNature</nature> <nature>org.eclipse.jdt.core.javanature</nature> + <nature>com.instantiations.assist.eclipse.coverage.codeCoverageNature</nature> </natures> </projectDescription> diff --git a/src/com.gluster.storage.management.core/junit/com/gluster/storage/management/core/utils/StringUtilTest.java b/src/com.gluster.storage.management.core/junit/com/gluster/storage/management/core/utils/StringUtilTest.java index 15cdbcaa..dc8c6c80 100644 --- a/src/com.gluster.storage.management.core/junit/com/gluster/storage/management/core/utils/StringUtilTest.java +++ b/src/com.gluster.storage.management.core/junit/com/gluster/storage/management/core/utils/StringUtilTest.java @@ -77,6 +77,23 @@ public class StringUtilTest { String result = StringUtil.collectionToString(string, delimiter); assertEquals("test ## string##java world", result); } + + /** + * Run the String collectionToString(Collection<? extends Object>,String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 21/9/11 4:53 PM + */ + @Test + public void testCollectionToString_4() + throws Exception { + List<String> string = new ArrayList<String>(); + String delimiter = ""; + + String result = StringUtil.collectionToString(string, delimiter); + assertEquals("", result); + } /** * Run the List<String> enumToArray(T[]) method test. @@ -234,42 +251,6 @@ public class StringUtilTest { } /** - * Run the String formatNumber(Double,int) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 21/9/11 4:53 PM - */ - @Test - public void testFormatNumber_1() - throws Exception { - Double number = new Double(1.0); - int dec = 1; - - String result = StringUtil.formatNumber(number, dec); - - assertEquals("1", result); - } - - /** - * Run the String formatNumber(Double,int) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 21/9/11 4:53 PM - */ - @Test - public void testFormatNumber_2() - throws Exception { - Double number = new Double(105.87); - int dec = 1; - - String result = StringUtil.formatNumber(number, dec); - - assertEquals("105.9", result); - } - - /** * Run the String removeSpaces(String) method test. * * @throws Exception diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/utils/StringUtil.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/utils/StringUtil.java index cdf71dcc..7d9ec340 100644 --- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/utils/StringUtil.java +++ b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/utils/StringUtil.java @@ -18,7 +18,6 @@ *******************************************************************************/ package com.gluster.storage.management.core.utils; -import java.text.NumberFormat; import java.util.ArrayList; import java.util.Collection; import java.util.LinkedHashMap; @@ -101,27 +100,4 @@ public class StringUtil { } return output; } - - public static String formatNumber(Double number, int dec) { - NumberFormat nf = NumberFormat.getInstance(); - nf.setMaximumFractionDigits(dec); - nf.setGroupingUsed(false); - // Setting this to true will give you xx,xxx,xxx type of formatting. - String formattedvalue = nf.format(number); - return formattedvalue; - } - - public static void main(String args[]) { - - //Test case for "ListToString" - List<String> string = new ArrayList<String>(); - // Empty list - System.out.println(StringUtil.collectionToString(string, ", ")); - // Only one - string.add("test"); - System.out.println(StringUtil.collectionToString(string, ",:")); - // Multiple - string.add("welcome to java"); - System.out.println(StringUtil.collectionToString(string, "")); - } } |