Revision: 529
http://openutils.svn.sourceforge.net/openutils/?rev=529&view=rev
Author: fgiust
Date: 2008-01-20 00:58:09 -0800 (Sun, 20 Jan 2008)
Log Message:
-----------
new TestUtils class
Added Paths:
-----------
trunk/openutils-testing/src/main/java/it/openutils/testing/TestUtils.java
Added: trunk/openutils-testing/src/main/java/it/openutils/testing/TestUtils.java
===================================================================
--- trunk/openutils-testing/src/main/java/it/openutils/testing/TestUtils.java (rev 0)
+++ trunk/openutils-testing/src/main/java/it/openutils/testing/TestUtils.java 2008-01-20 08:58:09 UTC (rev 529)
@@ -0,0 +1,66 @@
+/*
+ * Copyright Openmind http://www.openmindonline.it
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package it.openutils.testing;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+
+/**
+ * @author fgiust
+ * @version $Id: $
+ */
+public final class TestUtils
+{
+
+ private TestUtils()
+ {
+ }
+
+ /**
+ * Create a new set with all the elements.
+ * @param <T> the type of the elements. Also used to allocate the set.
+ * @param elements to put in the set.
+ * @return new allocated set.
+ */
+ public static <T> Set<T> setWith(T... elements)
+ {
+ Set<T> newSet = new HashSet<T>(elements.length);
+ for (T element : elements)
+ {
+ newSet.add(element);
+ }
+ return newSet;
+ }
+
+ /**
+ * Create a new list with all the elements.
+ * @param <T> the type of the elements. Also used to allocate the list.
+ * @param elements to put in the list.
+ * @return new allocated list.
+ */
+ public static <T> List<T> listWith(T... elements)
+ {
+ List<T> newList = new ArrayList<T>(elements.length);
+ for (T element : elements)
+ {
+ newList.add(element);
+ }
+ return newList;
+ }
+}
Property changes on: trunk/openutils-testing/src/main/java/it/openutils/testing/TestUtils.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|