From a108e8bce15c71acec55b2d20cff546c0ae0a647 Mon Sep 17 00:00:00 2001 From: Tal Gitelman Date: Wed, 30 May 2018 18:19:45 +0300 Subject: new unit tests for sdc-dao Change-Id: I734ad9a0ef636ed6a2d70ff68dd06036bf2447e3 Issue-ID: SDC-1333 Signed-off-by: Tal Gitelman --- .../src/main/java/org/openecomp/sdc/be/dao/utils/DaoUtils.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'catalog-dao/src/main/java/org') diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/utils/DaoUtils.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/utils/DaoUtils.java index b21d1e9630..35941dea89 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/utils/DaoUtils.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/utils/DaoUtils.java @@ -29,7 +29,11 @@ import com.google.gson.Gson; * Utility class for convertation to/from JSON string */ public class DaoUtils { - + + private DaoUtils() { + + } + /** * Convert from Object to Json string * @@ -52,6 +56,10 @@ public class DaoUtils { * @return object */ public static T convertFromJson(Class clazz, String json) { + if (clazz == null) { + throw new RuntimeException("The Class cannot be NULL!!!"); + } + Gson gson = new Gson(); // Or use new GsonBuilder().create(); return gson.fromJson(json, clazz); // deserializes json into target2 } -- cgit 1.2.3-korg