diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/DistribStatusEventTableDesc.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/DistribStatusEventTableDesc.java
index 7e64605..ff40d06 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/DistribStatusEventTableDesc.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/DistribStatusEventTableDesc.java
@@ -21,14 +21,16 @@
 
 import com.datastax.driver.core.DataType;
 import java.util.Map;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
 import org.apache.commons.lang3.tuple.ImmutablePair;
 import org.openecomp.sdc.be.resources.data.auditing.AuditingTypesConstants;
 
 public class DistribStatusEventTableDesc extends DistribBaseEventTableDesc {
 
     @Override
-    protected void updateColumnDistribDescription(Map<String, ImmutablePair<DataType, Boolean>> columns) {
-        for (DSEFieldsDescription field : DSEFieldsDescription.values()) {
+    protected void updateColumnDistribDescription(final Map<String, ImmutablePair<DataType, Boolean>> columns) {
+        for (final DSEFieldsDescription field : DSEFieldsDescription.values()) {
             columns.put(field.getName(), new ImmutablePair<>(field.type, field.indexed));
         }
     }
@@ -38,7 +40,9 @@
         return AuditingTypesConstants.DISTRIBUTION_STATUS_EVENT_TYPE;
     }
 
-    enum DSEFieldsDescription {
+    @Getter
+    @AllArgsConstructor
+    private enum DSEFieldsDescription {
         // @formatter:off
         DID("did", DataType.varchar(), true),
         CONSUMER_ID("consumer_id", DataType.varchar(), false),
@@ -47,26 +51,9 @@
         STATUS_TIME("status_time", DataType.varchar(), false);
         // @formatter:on
 
-        private String name;
-        private DataType type;
-        private boolean indexed;
+        private final String name;
+        private final DataType type;
+        private final boolean indexed;
 
-        DSEFieldsDescription(String name, DataType type, boolean indexed) {
-            this.name = name;
-            this.type = type;
-            this.indexed = indexed;
-        }
-
-        public String getName() {
-            return name;
-        }
-
-        public DataType getType() {
-            return type;
-        }
-
-        public boolean isIndexed() {
-            return indexed;
-        }
     }
 }
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/utils/JsonUtil.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/utils/JsonUtil.java
index ebcb1d5..8153d44 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/utils/JsonUtil.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/utils/JsonUtil.java
@@ -139,10 +139,4 @@
         return mapper.readValue(json, type);
     }
 
-    public static <T> List<T> toList(String json, Class<T> elementClass, Class<?> elementGenericClass) throws IOException {
-        ObjectMapper mapper = getOneObjectMapper();
-        JavaType elementType = mapper.getTypeFactory().constructParametricType(elementClass, elementGenericClass);
-        JavaType listType = mapper.getTypeFactory().constructCollectionType(List.class, elementType);
-        return mapper.readValue(json, listType);
-    }
 }
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/CategoryData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/CategoryData.java
index 229d774..f4f9294 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/CategoryData.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/CategoryData.java
@@ -21,10 +21,16 @@
 
 import java.util.HashMap;
 import java.util.Map;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
 import org.openecomp.sdc.be.dao.graph.datatype.GraphNode;
 import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary;
 import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
 
+@Getter
+@Setter
+@ToString
 public abstract class CategoryData extends GraphNode {
 
     private String name;
@@ -59,38 +65,9 @@
         return map;
     }
 
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    public String getNormalizedName() {
-        return normalizedName;
-    }
-
-    public void setNormalizedName(String normalizedName) {
-        this.normalizedName = normalizedName;
-    }
-
-    @Override
-    public String toString() {
-        return "CategoryData [name=" + name + ", normalizedName=" + normalizedName + "uniqueId=" + uniqueId + "]";
-    }
-
     @Override
     public String getUniqueIdKey() {
         return GraphPropertiesDictionary.UNIQUE_ID.getProperty();
     }
 
-    @Override
-    public String getUniqueId() {
-        return uniqueId;
-    }
-
-    public void setUniqueId(String uniqueId) {
-        this.uniqueId = uniqueId;
-    }
 }
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/DistribStatusEventTableDescTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/DistribStatusEventTableDescTest.java
index 34529f2..036b86e 100644
--- a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/DistribStatusEventTableDescTest.java
+++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/DistribStatusEventTableDescTest.java
@@ -7,9 +7,9 @@
  * 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.
@@ -21,46 +21,30 @@
 package org.openecomp.sdc.be.dao.cassandra.schema.tables;
 
 import com.datastax.driver.core.DataType;
-import mockit.Deencapsulation;
-import org.apache.commons.lang3.tuple.ImmutablePair;
-import org.junit.Test;
-import org.openecomp.sdc.be.dao.cassandra.schema.tables.DistribStatusEventTableDesc.DSEFieldsDescription;
-
-import java.util.HashMap;
 import java.util.Map;
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import org.openecomp.sdc.be.resources.data.auditing.AuditingTypesConstants;
 
-public class DistribStatusEventTableDescTest {
+class DistribStatusEventTableDescTest {
 
-	private DistribStatusEventTableDesc createTestSubject() {
-		return new DistribStatusEventTableDesc();
-	}
+    private DistribStatusEventTableDesc createTestSubject() {
+        return new DistribStatusEventTableDesc();
+    }
 
-	@Test
-	public void testUpdateColumnDistribDescription() throws Exception {
-		DistribStatusEventTableDesc testSubject;
-		Map<String, ImmutablePair<DataType, Boolean>> columns = new HashMap<>();
+    @Test
+    void testUpdateColumnDistribDescription() throws Exception {
+        final DistribStatusEventTableDesc testSubject = createTestSubject();
+        final Map<String, ImmutablePair<DataType, Boolean>> columnDescription = testSubject.getColumnDescription();
+        Assertions.assertNotNull(columnDescription);
+        Assertions.assertEquals(10, columnDescription.size());
+    }
 
-		// default test
-		testSubject = createTestSubject();
-		Deencapsulation.invoke(testSubject, "updateColumnDistribDescription", columns);
-	}
+    @Test
+    void testGetTableName() throws Exception {
+        final DistribStatusEventTableDesc testSubject = createTestSubject();
+        Assertions.assertEquals(AuditingTypesConstants.DISTRIBUTION_STATUS_EVENT_TYPE, testSubject.getTableName());
+    }
 
-	@Test
-	public void testGetTableName() throws Exception {
-		DistribStatusEventTableDesc testSubject;
-		String result;
-
-		// default test
-		testSubject = createTestSubject();
-		result = testSubject.getTableName();
-	}
-	
-	@Test
-	public void testDSEFieldsDescription() throws Exception {
-		DSEFieldsDescription testSubject = DistribStatusEventTableDesc.DSEFieldsDescription.CONSUMER_ID;
-		
-		testSubject.getName();
-		testSubject.getType();
-		testSubject.isIndexed();
-	}
 }
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/graph/GraphElementFactoryTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/graph/GraphElementFactoryTest.java
index 931186d..4156c41 100644
--- a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/graph/GraphElementFactoryTest.java
+++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/graph/GraphElementFactoryTest.java
@@ -7,9 +7,9 @@
  * 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.
@@ -20,81 +20,81 @@
 
 package org.openecomp.sdc.be.dao.graph;
 
-import mockit.Deencapsulation;
-import org.junit.Test;
+import static org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum.AnnotationType;
+import static org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum.Component;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
 import org.mockito.Mockito;
 import org.openecomp.sdc.be.config.ConfigurationManager;
 import org.openecomp.sdc.be.dao.graph.datatype.GraphElementTypeEnum;
 import org.openecomp.sdc.be.dao.graph.datatype.GraphNode;
 import org.openecomp.sdc.be.dao.graph.datatype.GraphRelation;
+import org.openecomp.sdc.be.dao.graph.datatype.RelationEndPoint;
 import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
 import org.openecomp.sdc.common.api.ConfigurationSource;
 import org.openecomp.sdc.common.impl.ExternalConfiguration;
 import org.openecomp.sdc.common.impl.FSConfigurationSource;
 
-import java.util.HashMap;
-import java.util.Map;
+class GraphElementFactoryTest {
 
-public class GraphElementFactoryTest {
+    private static ConfigurationSource configurationSource = new FSConfigurationSource(ExternalConfiguration.getChangeListener(),
+        "src/test/resources/config/catalog-dao");
+    private static ConfigurationManager configurationManager = new ConfigurationManager(configurationSource);
 
-	private static ConfigurationSource configurationSource = new FSConfigurationSource(ExternalConfiguration.getChangeListener(),
-			"src/test/resources/config/catalog-dao");
-	private static ConfigurationManager configurationManager = new ConfigurationManager(configurationSource);
+    @Test
+    void testCreateElement() throws Exception {
+        Map<String, Object> properties = new HashMap<>();
+        Arrays.stream(NodeTypeEnum.values()).filter(nodeTypeEnum -> !nodeTypeEnum.equals(AnnotationType) && !nodeTypeEnum.equals(Component))
+            .forEach(nodeTypeEnum -> {
+                Assertions.assertTrue(GraphElementFactory
+                    .createElement(nodeTypeEnum.getName(), GraphElementTypeEnum.Node, properties, GraphNode.class) instanceof GraphNode);
+            });
+        Assertions.assertNull(GraphElementFactory.createElement(Component.getName(), GraphElementTypeEnum.Node, properties, GraphNode.class));
+        Assertions.assertThrows(NullPointerException.class,
+            () -> GraphElementFactory.createElement(AnnotationType.getName(), GraphElementTypeEnum.Node, properties, GraphNode.class));
+    }
 
-	@Test
-	public void testCreateElement() throws Exception {
-		String label = "mock";
-		Map<String, Object> properties = new HashMap<>();
-		Class<GraphNode> clazz = (Class<GraphNode>) (Mockito.mock(GraphNode.class)).getClass();
+    @Test
+    void testCreateRelation() throws Exception {
+        GraphRelation result = GraphElementFactory.createRelation("", new HashMap<>(), Mockito.mock(GraphNode.class), Mockito.mock(GraphNode.class));
+        Assertions.assertTrue(result instanceof GraphRelation);
+        Assertions.assertTrue(result.getFrom() instanceof RelationEndPoint);
+        Assertions.assertTrue(result.getTo() instanceof RelationEndPoint);
+    }
 
-		// default test
-		GraphElementFactory.createElement(label, GraphElementTypeEnum.Node, properties, clazz);
-	}
+    @Test
+    void testCreateNode() throws Exception {
+        Map<String, Object> properties = new HashMap<>();
+        GraphNode result;
 
-	@Test
-	public void testCreateElement_1() throws Exception {
-		String label = "mock";
-		GraphElementTypeEnum type = null;
-		Map<String, Object> properties = new HashMap<>();
-		GraphNode result;
-
-		// default test
-		result = GraphElementFactory.createElement(label, GraphElementTypeEnum.Node, properties);
-	}
-
-	@Test
-	public void testCreateRelation() throws Exception {
-		String type = "";
-		Map<String, Object> properties = new HashMap<>();
-		GraphNode from = Mockito.mock(GraphNode.class);
-		GraphNode to = Mockito.mock(GraphNode.class);
-		;
-		GraphRelation result;
-
-		// default test
-		result = GraphElementFactory.createRelation(type, properties, from, to);
-	}
-
-	@Test
-	public void testCreateNode() throws Exception {
-		Map<String, Object> properties = new HashMap<>();
-		GraphNode result;
-
-		result = Deencapsulation.invoke(GraphElementFactory.class, "createNode", NodeTypeEnum.User.getName(),
-				properties);
-		result = Deencapsulation.invoke(GraphElementFactory.class, "createNode",
-				NodeTypeEnum.ResourceCategory.getName(), properties);
-		result = Deencapsulation.invoke(GraphElementFactory.class, "createNode", NodeTypeEnum.ServiceCategory.getName(),
-				properties);
-		result = Deencapsulation.invoke(GraphElementFactory.class, "createNode", NodeTypeEnum.Tag.getName(),
-				properties);
-		result = Deencapsulation.invoke(GraphElementFactory.class, "createNode", NodeTypeEnum.Service.getName(),
-				properties);
-		result = Deencapsulation.invoke(GraphElementFactory.class, "createNode", NodeTypeEnum.Property.getName(),
-				properties);
-		result = Deencapsulation.invoke(GraphElementFactory.class, "createNode", NodeTypeEnum.HeatParameter.getName(),
-				properties);
-		result = Deencapsulation.invoke(GraphElementFactory.class, "createNode",
-				NodeTypeEnum.HeatParameterValue.getName(), properties);
-	}
+        result = GraphElementFactory.createElement(NodeTypeEnum.User.getName(), GraphElementTypeEnum.Node, properties);
+        Assertions.assertNotNull(result);
+        Assertions.assertTrue(result instanceof GraphNode);
+        result = GraphElementFactory.createElement(NodeTypeEnum.ResourceCategory.getName(), GraphElementTypeEnum.Node, properties);
+        Assertions.assertNotNull(result);
+        Assertions.assertTrue(result instanceof GraphNode);
+        result = GraphElementFactory.createElement(NodeTypeEnum.ServiceCategory.getName(), GraphElementTypeEnum.Node, properties);
+        Assertions.assertNotNull(result);
+        result = GraphElementFactory.createElement(NodeTypeEnum.Tag.getName(), GraphElementTypeEnum.Node, properties);
+        Assertions.assertTrue(result instanceof GraphNode);
+        Assertions.assertNotNull(result);
+        result = GraphElementFactory.createElement(NodeTypeEnum.Service.getName(), GraphElementTypeEnum.Node, properties);
+        Assertions.assertNotNull(result);
+        Assertions.assertTrue(result instanceof GraphNode);
+        result = GraphElementFactory.createElement(NodeTypeEnum.Property.getName(), GraphElementTypeEnum.Node, properties);
+        Assertions.assertNotNull(result);
+        result = GraphElementFactory.createElement(NodeTypeEnum.Resource.getName(), GraphElementTypeEnum.Node, properties);
+        Assertions.assertTrue(result instanceof GraphNode);
+        Assertions.assertNotNull(result);
+        result = GraphElementFactory.createElement(NodeTypeEnum.HeatParameter.getName(), GraphElementTypeEnum.Node, properties);
+        Assertions.assertNotNull(result);
+        Assertions.assertTrue(result instanceof GraphNode);
+        result = GraphElementFactory.createElement(NodeTypeEnum.HeatParameterValue.getName(), GraphElementTypeEnum.Node, properties);
+        Assertions.assertNotNull(result);
+        Assertions.assertTrue(result instanceof GraphNode);
+    }
 }
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/utils/JsonUtilTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/utils/JsonUtilTest.java
index 5eccc78..98dda47 100644
--- a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/utils/JsonUtilTest.java
+++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/utils/JsonUtilTest.java
@@ -21,82 +21,65 @@
  */
 package org.openecomp.sdc.be.dao.utils;
 
-import com.fasterxml.jackson.databind.ObjectMapper;
-import mockit.Deencapsulation;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-import java.io.InputStream;
 import java.util.List;
 import java.util.Map;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
 
-public class JsonUtilTest {
-	
-	@Test
-	public void testGetOneObjectMapper() throws Exception {
-		ObjectMapper result;
+class JsonUtilTest {
 
-		// default test
-		result = Deencapsulation.invoke(JsonUtil.class, "getOneObjectMapper");
-	}
+    @Test
+    void testReadObject_1() throws Exception {
+        final String objectText = "{}";
+        final Class objectClass = Object.class;
+        final Object result = JsonUtil.readObject(objectText, objectClass);
+        Assertions.assertNotNull(result);
+        Assertions.assertTrue(result instanceof Map);
+        Assertions.assertEquals(0, ((Map) result).size());
+    }
 
-	@Test
-	public void testReadObject() throws Exception {
-		String objectText = "{}";
-		Class objectClass = Object.class;
-		Object result;
+    @Test
+    void testReadObject_2() throws Exception {
+        final String objectText = "{}";
+        final Object result = JsonUtil.readObject(objectText);
+        Assertions.assertNotNull(result);
+        Assertions.assertTrue(result instanceof Map);
+        Assertions.assertEquals(0, ((Map) result).size());
+    }
 
-		// default test
-		result = JsonUtil.readObject(objectText, objectClass);
-	}
+    @Test
+    void testToMap_1() throws Exception {
+        final String json = "{\"name\":\"mock\",\"age\":0}";
+        final Map<String, Object> result = JsonUtil.toMap(json);
+        Assertions.assertNotNull(result);
+        Assertions.assertEquals(2, result.size());
+    }
 
-	@Test
-	public void testReadObject_2() throws Exception {
-		String objectText = "{}";
-		Object result;
+    @Test
+    void testToMap_2() throws Exception {
+        final String json = "{\"name\":\"mock\",\"age\":0}";
+        final Class keyTypeClass = Object.class;
+        final Class valueTypeClass = Object.class;
+        final Map result = JsonUtil.toMap(json, keyTypeClass, valueTypeClass);
+        Assertions.assertNotNull(result);
+        Assertions.assertEquals(2, result.size());
+    }
 
-		// default test
-		result = JsonUtil.readObject(objectText);
-	}
+    @Test
+    void testToArray() throws Exception {
+        final String json = "[]";
+        final Class valueTypeClass = Object.class;
+        final Object[] result = JsonUtil.toArray(json, valueTypeClass);
+        Assertions.assertNotNull(result);
+    }
 
-	@Test
-	public void testToMap() throws Exception {
-		String json = "{\"name\":\"mock\",\"age\":0}";
-		Map<String, Object> result;
+    @Test
+    void testToList_1() throws Exception {
+        final String json = "[]";
+        final Class clazz = Object.class;
+        final List result = JsonUtil.toList(json, clazz);
+        Assertions.assertNotNull(result);
+        Assertions.assertEquals(0, result.size());
+    }
 
-		// default test
-		result = JsonUtil.toMap(json);
-	}
-
-	@Test
-	public void testToMap_1() throws Exception {
-		String json = "{\"name\":\"mock\",\"age\":0}";
-		Class keyTypeClass = Object.class;
-		Class valueTypeClass = Object.class;
-		Map result;
-
-		// default test
-		result = JsonUtil.toMap(json, keyTypeClass, valueTypeClass);
-	}
-
-	@Test
-	public void testToArray() throws Exception {
-		String json = "[]";
-		Class valueTypeClass = Object.class;
-		Object[] result;
-
-		// default test
-		result = JsonUtil.toArray(json, valueTypeClass);
-	}
-
-	@Test
-	public void testToList() throws Exception {
-		String json = "[]";
-		Class clazz = Object.class;
-		List result;
-
-		// default test
-		result = JsonUtil.toList(json, clazz);
-	}
-}
\ No newline at end of file
+}
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/ServiceCategoryDataTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/ServiceCategoryDataTest.java
index da0239a..ba1f735 100644
--- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/ServiceCategoryDataTest.java
+++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/ServiceCategoryDataTest.java
@@ -7,9 +7,9 @@
  * 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.
@@ -20,28 +20,18 @@
 
 package org.openecomp.sdc.be.resources.data;
 
-import mockit.Deencapsulation;
-import org.apache.commons.collections.map.HashedMap;
-import org.junit.Test;
 
-public class ServiceCategoryDataTest {
+import java.util.HashMap;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
 
-	private ServiceCategoryData createTestSubject() {
-		return new ServiceCategoryData();
-	}
+class ServiceCategoryDataTest {
 
-	@Test
-	public void testCtor() throws Exception {
-		new ServiceCategoryData(new HashedMap());
-		new ServiceCategoryData("mock");
-	}
-	
-	@Test
-	public void testCreateUniqueId() throws Exception {
-		ServiceCategoryData testSubject;
+    @Test
+    void testCtor() throws Exception {
+        Assertions.assertNotNull(new ServiceCategoryData());
+        Assertions.assertNotNull(new ServiceCategoryData(new HashMap()));
+        Assertions.assertNotNull(new ServiceCategoryData("mock"));
+    }
 
-		// default test
-		testSubject = createTestSubject();
-		Deencapsulation.invoke(testSubject, "createUniqueId");
-	}
 }
