Refactor Argeo API
[gpl/argeo-slc.git] / org.argeo.slc.runtime / src / org / argeo / slc / runtime / test / TestDataUtils.java
index b2d74a7c90aeeaa8fa8f06459d5243c3f23d7e98..e5d8c7b2f27c0fd4f1eae2369b593ca4b1aef5a1 100644 (file)
@@ -1,63 +1,48 @@
-/*\r
- * Copyright (C) 2007-2012 Argeo GmbH\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- *         http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.argeo.slc.runtime.test;\r
-\r
-import org.argeo.slc.UnsupportedException;\r
-import org.argeo.slc.test.TestData;\r
-import org.argeo.slc.test.TestDataProvider;\r
-\r
-/** Utilities for dealing with test datas. */\r
-public class TestDataUtils {\r
-       /** Extracts the test data from the given provider. */\r
-       public static <T extends TestData> T getFromProvider(Object obj,\r
-                       Class<T> clss, String key) {\r
-               if (obj instanceof TestDataProvider) {\r
-                       TestDataProvider testDataProvider = (TestDataProvider) obj;\r
-                       return testDataProvider.getTestData(clss, key);\r
-               } else {\r
-                       throw new UnsupportedException("test data provider", obj);\r
-               }\r
-       }\r
-\r
-       /**\r
-        * Extracts the test data from the given provider using <code>null</code>\r
-        * as key.\r
-        */\r
-       public static <T extends TestData> T getFromProvider(Object obj,\r
-                       Class<T> clss) {\r
-               return getFromProvider(obj, clss, null);\r
-       }\r
-\r
-       /**\r
-        * Returns it self after making the proper checks. Used for test data being\r
-        * their own data providers.\r
-        */\r
-       @SuppressWarnings("unchecked")\r
-       public static <T extends TestData> T getItSelf(Class<T> clss,\r
-                       TestData testDataObject) {\r
-               if (clss.isAssignableFrom(testDataObject.getClass())) {\r
-                       return (T) testDataObject;\r
-               } else {\r
-                       throw new UnsupportedException("test data", testDataObject);\r
-               }\r
-\r
-       }\r
-\r
-       /** Makes sure this is an utility class. */\r
-       private TestDataUtils() {\r
-\r
-       }\r
-}\r
+package org.argeo.slc.runtime.test;
+
+import org.argeo.api.slc.UnsupportedException;
+import org.argeo.api.slc.test.TestData;
+import org.argeo.api.slc.test.TestDataProvider;
+
+/** Utilities for dealing with test datas. */
+public class TestDataUtils {
+       /** Extracts the test data from the given provider. */
+       public static <T extends TestData> T getFromProvider(Object obj,
+                       Class<T> clss, String key) {
+               if (obj instanceof TestDataProvider) {
+                       TestDataProvider testDataProvider = (TestDataProvider) obj;
+                       return testDataProvider.getTestData(clss, key);
+               } else {
+                       throw new UnsupportedException("test data provider", obj);
+               }
+       }
+
+       /**
+        * Extracts the test data from the given provider using <code>null</code>
+        * as key.
+        */
+       public static <T extends TestData> T getFromProvider(Object obj,
+                       Class<T> clss) {
+               return getFromProvider(obj, clss, null);
+       }
+
+       /**
+        * Returns it self after making the proper checks. Used for test data being
+        * their own data providers.
+        */
+       @SuppressWarnings("unchecked")
+       public static <T extends TestData> T getItSelf(Class<T> clss,
+                       TestData testDataObject) {
+               if (clss.isAssignableFrom(testDataObject.getClass())) {
+                       return (T) testDataObject;
+               } else {
+                       throw new UnsupportedException("test data", testDataObject);
+               }
+
+       }
+
+       /** Makes sure this is an utility class. */
+       private TestDataUtils() {
+
+       }
+}