summaryrefslogtreecommitdiffstats
path: root/portal-BE/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'portal-BE/src/test')
-rw-r--r--portal-BE/src/test/java/org/onap/portal/service/PersUserWidgetServiceTest.java48
1 files changed, 48 insertions, 0 deletions
diff --git a/portal-BE/src/test/java/org/onap/portal/service/PersUserWidgetServiceTest.java b/portal-BE/src/test/java/org/onap/portal/service/PersUserWidgetServiceTest.java
new file mode 100644
index 00000000..35952053
--- /dev/null
+++ b/portal-BE/src/test/java/org/onap/portal/service/PersUserWidgetServiceTest.java
@@ -0,0 +1,48 @@
+package org.onap.portal.service;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+import javax.transaction.Transactional;
+import org.junit.jupiter.api.Test;
+import org.junit.runner.RunWith;
+import org.onap.portal.domain.dto.transport.WidgetCatalogPersonalization;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.TestPropertySource;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest
+@Transactional
+@TestPropertySource(locations = "classpath:test.properties")
+class PersUserWidgetServiceTest {
+
+ @Autowired
+ private PersUserWidgetService persUserWidgetService;
+
+ @Test
+ void setPersUserAppValueInvalidWidgetIdDataTest() {
+ WidgetCatalogPersonalization catalog = getWidgetCatalog();
+ catalog.setSelect(true);
+ try {
+ persUserWidgetService.setPersUserAppValue(1, catalog);
+ }catch (IllegalArgumentException e){
+ assertEquals("widgetId may not be null", e.getMessage());
+ }
+ }
+
+ @Test
+ void setPersUserAppValueInvalidSelectDataTest() {
+ WidgetCatalogPersonalization catalog = getWidgetCatalog();
+ catalog.setWidgetId(1L);
+ try {
+ persUserWidgetService.setPersUserAppValue(1, catalog);
+ }catch (IllegalArgumentException e){
+ assertEquals("select may not be null", e.getMessage());
+ }
+ }
+
+ private WidgetCatalogPersonalization getWidgetCatalog(){
+ return new WidgetCatalogPersonalization();
+ }
+}