summaryrefslogtreecommitdiffstats
path: root/ONAP-SDK-APP
diff options
context:
space:
mode:
Diffstat (limited to 'ONAP-SDK-APP')
-rw-r--r--ONAP-SDK-APP/src/test/java/org/onap/portalapp/conf/ExternalAppConfigTest.java69
-rw-r--r--ONAP-SDK-APP/src/test/java/org/onap/portalapp/conf/ExternalAppInitializerTest.java41
-rw-r--r--ONAP-SDK-APP/src/test/java/org/onap/portalapp/conf/HibernateMappingLocationsTest.java19
-rw-r--r--ONAP-SDK-APP/src/test/java/org/onap/portalapp/filter/SecurityXssFilterTest.java40
-rw-r--r--ONAP-SDK-APP/src/test/java/org/onap/portalapp/login/LoginStrategyImplTest.java24
-rw-r--r--ONAP-SDK-APP/src/test/java/org/onap/portalapp/scheduler/RegisterTest.java8
-rw-r--r--ONAP-SDK-APP/src/test/java/org/onap/portalapp/scheduler/RegistryAdapterTest.java68
-rw-r--r--ONAP-SDK-APP/src/test/java/org/onap/portalapp/service/AdminAuthExtensionTest.java98
8 files changed, 188 insertions, 179 deletions
diff --git a/ONAP-SDK-APP/src/test/java/org/onap/portalapp/conf/ExternalAppConfigTest.java b/ONAP-SDK-APP/src/test/java/org/onap/portalapp/conf/ExternalAppConfigTest.java
index 133d4a860..fb11e246c 100644
--- a/ONAP-SDK-APP/src/test/java/org/onap/portalapp/conf/ExternalAppConfigTest.java
+++ b/ONAP-SDK-APP/src/test/java/org/onap/portalapp/conf/ExternalAppConfigTest.java
@@ -1,15 +1,17 @@
/*-
* ============LICENSE_START=======================================================
- * ONAP Policy Engine
+ * ONAP Portal SDK
* ================================================================================
* Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -36,37 +38,36 @@ import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
public class ExternalAppConfigTest {
- @Test
- public void testConfig() throws MalformedURLException {
- // Setup test data
- ApplicationContext ctx = Mockito.mock(ApplicationContext.class);
- UrlResource value = new UrlResource("http://localhost");
- Mockito.when(ctx.getResource(Mockito.any())).thenReturn(value);
- ResourceHandlerRegistry registry = new ResourceHandlerRegistry(ctx, null);
- InterceptorRegistry interceptor = new InterceptorRegistry();
- RegistryAdapter schedulerRegistryAdapter = new RegistryAdapter();
- Registerable reg = Mockito.mock(Registerable.class);
- Mockito.when(reg.getTriggers()).thenReturn(new Trigger[1]);
- schedulerRegistryAdapter.setRegistry(reg);
- WorkflowScheduleService workflowScheduleService = Mockito.mock(WorkflowScheduleService.class);
- schedulerRegistryAdapter.setWorkflowScheduleService(workflowScheduleService);
- Mockito.when(workflowScheduleService.triggerWorkflowScheduling())
- .thenReturn(Collections.emptyList());
+ @Test
+ public void testConfig() throws MalformedURLException {
+ // Setup test data
+ ApplicationContext ctx = Mockito.mock(ApplicationContext.class);
+ UrlResource value = new UrlResource("http://localhost");
+ Mockito.when(ctx.getResource(Mockito.any())).thenReturn(value);
+ ResourceHandlerRegistry registry = new ResourceHandlerRegistry(ctx, null);
+ InterceptorRegistry interceptor = new InterceptorRegistry();
+ RegistryAdapter schedulerRegistryAdapter = new RegistryAdapter();
+ Registerable reg = Mockito.mock(Registerable.class);
+ Mockito.when(reg.getTriggers()).thenReturn(new Trigger[1]);
+ schedulerRegistryAdapter.setRegistry(reg);
+ WorkflowScheduleService workflowScheduleService = Mockito.mock(WorkflowScheduleService.class);
+ schedulerRegistryAdapter.setWorkflowScheduleService(workflowScheduleService);
+ Mockito.when(workflowScheduleService.triggerWorkflowScheduling()).thenReturn(Collections.emptyList());
- // Test constructor
- ExternalAppConfig config = new ExternalAppConfig();
- assertNotNull(config);
+ // Test constructor
+ ExternalAppConfig config = new ExternalAppConfig();
+ assertNotNull(config);
- // Test set and get
- config.setApplicationContext(ctx);
- assertNotNull(config.viewResolver());
- config.addResourceHandlers(registry);
- assertNotNull(config.dataAccessService());
- assertNotNull(config.addTileDefinitions());
- config.addInterceptors(interceptor);
- assertNotNull(config.cacheManager());
- config.setSchedulerRegistryAdapter(schedulerRegistryAdapter);
- assertNull(config.schedulerFactoryBean());
- assertNotNull(config.loginStrategy());
- }
+ // Test set and get
+ config.setApplicationContext(ctx);
+ assertNotNull(config.viewResolver());
+ config.addResourceHandlers(registry);
+ assertNotNull(config.dataAccessService());
+ assertNotNull(config.addTileDefinitions());
+ config.addInterceptors(interceptor);
+ assertNotNull(config.cacheManager());
+ config.setSchedulerRegistryAdapter(schedulerRegistryAdapter);
+ assertNull(config.schedulerFactoryBean());
+ assertNotNull(config.loginStrategy());
+ }
}
diff --git a/ONAP-SDK-APP/src/test/java/org/onap/portalapp/conf/ExternalAppInitializerTest.java b/ONAP-SDK-APP/src/test/java/org/onap/portalapp/conf/ExternalAppInitializerTest.java
index 81bf7e95a..7a2ab1654 100644
--- a/ONAP-SDK-APP/src/test/java/org/onap/portalapp/conf/ExternalAppInitializerTest.java
+++ b/ONAP-SDK-APP/src/test/java/org/onap/portalapp/conf/ExternalAppInitializerTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2018 AT&T Intellectual Property
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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,26 +22,25 @@
package org.onap.portalapp.conf;
import static org.junit.Assert.assertTrue;
-
import org.junit.Test;
public class ExternalAppInitializerTest {
- @Test
- public void testExternalAppInitializer(){
- ExternalAppInitializer initializer = new ExternalAppInitializer();
- assertTrue(initializer.getRootConfigClasses()!=null);
- assertTrue(initializer.getServletConfigClasses()!=null);
- assertTrue(initializer.getServletMappings()!=null);
- }
-
- @Test
- public void testExternalAppConfig(){
- ExternalAppConfig appConfig = new ExternalAppConfig();
- assertTrue(appConfig.dataAccessService()!=null);
- assertTrue(appConfig.addTileDefinitions()!=null);
- assertTrue(appConfig.cacheManager()!=null);
- assertTrue(appConfig.loginStrategy()!=null);
- assertTrue(appConfig.viewResolver()!=null);
- }
+ @Test
+ public void testExternalAppInitializer() {
+ ExternalAppInitializer initializer = new ExternalAppInitializer();
+ assertTrue(initializer.getRootConfigClasses() != null);
+ assertTrue(initializer.getServletConfigClasses() != null);
+ assertTrue(initializer.getServletMappings() != null);
+ }
+
+ @Test
+ public void testExternalAppConfig() {
+ ExternalAppConfig appConfig = new ExternalAppConfig();
+ assertTrue(appConfig.dataAccessService() != null);
+ assertTrue(appConfig.addTileDefinitions() != null);
+ assertTrue(appConfig.cacheManager() != null);
+ assertTrue(appConfig.loginStrategy() != null);
+ assertTrue(appConfig.viewResolver() != null);
+ }
}
diff --git a/ONAP-SDK-APP/src/test/java/org/onap/portalapp/conf/HibernateMappingLocationsTest.java b/ONAP-SDK-APP/src/test/java/org/onap/portalapp/conf/HibernateMappingLocationsTest.java
index 6762e4aee..25d878e8c 100644
--- a/ONAP-SDK-APP/src/test/java/org/onap/portalapp/conf/HibernateMappingLocationsTest.java
+++ b/ONAP-SDK-APP/src/test/java/org/onap/portalapp/conf/HibernateMappingLocationsTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2018 AT&T Intellectual Property
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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,15 +22,14 @@
package org.onap.portalapp.conf;
import static org.junit.Assert.assertTrue;
-
import org.junit.Test;
public class HibernateMappingLocationsTest {
- @Test
- public void testHibernateMappingLocations(){
- HibernateMappingLocations locations = new HibernateMappingLocations();
- assertTrue(locations.getMappingLocations()!=null);
- assertTrue(locations.getPackagesToScan()!=null);
- }
+ @Test
+ public void testHibernateMappingLocations() {
+ HibernateMappingLocations locations = new HibernateMappingLocations();
+ assertTrue(locations.getMappingLocations() != null);
+ assertTrue(locations.getPackagesToScan() != null);
+ }
}
diff --git a/ONAP-SDK-APP/src/test/java/org/onap/portalapp/filter/SecurityXssFilterTest.java b/ONAP-SDK-APP/src/test/java/org/onap/portalapp/filter/SecurityXssFilterTest.java
index 210b1d94f..65fe12376 100644
--- a/ONAP-SDK-APP/src/test/java/org/onap/portalapp/filter/SecurityXssFilterTest.java
+++ b/ONAP-SDK-APP/src/test/java/org/onap/portalapp/filter/SecurityXssFilterTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2018 AT&T Intellectual Property
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -32,21 +34,21 @@ import com.mockrunner.mock.web.MockHttpServletRequest;
import com.mockrunner.mock.web.MockHttpServletResponse;
public class SecurityXssFilterTest {
- @Test
- public void testGets() throws ServletException, IOException {
- SecurityXssFilter filter = new SecurityXssFilter();
- assertNotNull(filter);
-
- MockHttpServletRequest request = new MockHttpServletRequest();
- request.setMethod("POST");
- request.setBodyContent("testBody");
- request.setupAddParameter("testKey", "testVal");
- request.setAttribute("testKey", "testVal");
- request.setRequestURI("testVal");
- request.setRequestURL("testVal");
- MockHttpServletResponse response = new MockHttpServletResponse();
- FilterChain filterChain = Mockito.mock(FilterChain.class);
- filter.doFilterInternal(request, response, filterChain);
- assertEquals(response.getStatusCode(), HttpServletResponse.SC_OK);
- }
+ @Test
+ public void testGets() throws ServletException, IOException {
+ SecurityXssFilter filter = new SecurityXssFilter();
+ assertNotNull(filter);
+
+ MockHttpServletRequest request = new MockHttpServletRequest();
+ request.setMethod("POST");
+ request.setBodyContent("testBody");
+ request.setupAddParameter("testKey", "testVal");
+ request.setAttribute("testKey", "testVal");
+ request.setRequestURI("testVal");
+ request.setRequestURL("testVal");
+ MockHttpServletResponse response = new MockHttpServletResponse();
+ FilterChain filterChain = Mockito.mock(FilterChain.class);
+ filter.doFilterInternal(request, response, filterChain);
+ assertEquals(response.getStatusCode(), HttpServletResponse.SC_OK);
+ }
}
diff --git a/ONAP-SDK-APP/src/test/java/org/onap/portalapp/login/LoginStrategyImplTest.java b/ONAP-SDK-APP/src/test/java/org/onap/portalapp/login/LoginStrategyImplTest.java
index 25b677988..ac13bdc13 100644
--- a/ONAP-SDK-APP/src/test/java/org/onap/portalapp/login/LoginStrategyImplTest.java
+++ b/ONAP-SDK-APP/src/test/java/org/onap/portalapp/login/LoginStrategyImplTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2018 AT&T Intellectual Property
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -27,13 +29,13 @@ import org.onap.portalsdk.core.onboarding.exception.PortalAPIException;
import org.springframework.mock.web.MockHttpServletRequest;
public class LoginStrategyImplTest {
- @Test
- public void testLoginStrategyImpl() throws PortalAPIException {
- LoginStrategyImpl impl = new LoginStrategyImpl();
- MockHttpServletRequest request = new MockHttpServletRequest();
- Cookie cookie1 = new Cookie("EPService", "serviceName");
- Cookie cookie2 = new Cookie("UserId", "userName");
- request.setCookies(cookie1, cookie2);
- assertNull(impl.getUserId(request));
- }
+ @Test
+ public void testLoginStrategyImpl() throws PortalAPIException {
+ LoginStrategyImpl impl = new LoginStrategyImpl();
+ MockHttpServletRequest request = new MockHttpServletRequest();
+ Cookie cookie1 = new Cookie("EPService", "serviceName");
+ Cookie cookie2 = new Cookie("UserId", "userName");
+ request.setCookies(cookie1, cookie2);
+ assertNull(impl.getUserId(request));
+ }
}
diff --git a/ONAP-SDK-APP/src/test/java/org/onap/portalapp/scheduler/RegisterTest.java b/ONAP-SDK-APP/src/test/java/org/onap/portalapp/scheduler/RegisterTest.java
index 0f406b163..675a87e43 100644
--- a/ONAP-SDK-APP/src/test/java/org/onap/portalapp/scheduler/RegisterTest.java
+++ b/ONAP-SDK-APP/src/test/java/org/onap/portalapp/scheduler/RegisterTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2018 AT&T Intellectual Property
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -22,10 +24,8 @@ package org.onap.portalapp.scheduler;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
-
import java.util.ArrayList;
import java.util.List;
-
import org.junit.Test;
import org.quartz.Trigger;
import org.quartz.TriggerBuilder;
diff --git a/ONAP-SDK-APP/src/test/java/org/onap/portalapp/scheduler/RegistryAdapterTest.java b/ONAP-SDK-APP/src/test/java/org/onap/portalapp/scheduler/RegistryAdapterTest.java
index b49ad6a6d..a7386aa8a 100644
--- a/ONAP-SDK-APP/src/test/java/org/onap/portalapp/scheduler/RegistryAdapterTest.java
+++ b/ONAP-SDK-APP/src/test/java/org/onap/portalapp/scheduler/RegistryAdapterTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2018 AT&T Intellectual Property
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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.
@@ -30,39 +32,39 @@ import org.onap.portalsdk.workflow.services.WorkflowScheduleService;
import org.springframework.scheduling.quartz.SchedulerFactoryBean;
public class RegistryAdapterTest {
- @Rule
- public final ExpectedException thrown = ExpectedException.none();
+ @Rule
+ public final ExpectedException thrown = ExpectedException.none();
+
+ @Test
+ public void testRegistryAdapter() {
+ RegistryAdapter adapter = new RegistryAdapter();
+ SchedulerFactoryBean schedulerBean = new SchedulerFactoryBean();
+ Registerable registry = null;
+ WorkflowScheduleService workflowScheduleService = null;
+
+ adapter.setSchedulerBean(schedulerBean);
+ assertEquals(adapter.getSchedulerBean(), schedulerBean);
+ adapter.setRegistry(registry);
+ assertEquals(adapter.getRegistry(), registry);
+ adapter.setWorkflowScheduleService(workflowScheduleService);
+ assertEquals(adapter.getWorkflowScheduleService(), workflowScheduleService);
+ }
- @Test
- public void testRegistryAdapter() {
- RegistryAdapter adapter = new RegistryAdapter();
- SchedulerFactoryBean schedulerBean = new SchedulerFactoryBean();
- Registerable registry = null;
- WorkflowScheduleService workflowScheduleService = null;
+ @Test
+ public void testRegistryAdapterNegCase1() {
+ thrown.expect(NullPointerException.class);
- adapter.setSchedulerBean(schedulerBean);
- assertEquals(adapter.getSchedulerBean(), schedulerBean);
- adapter.setRegistry(registry);
- assertEquals(adapter.getRegistry(), registry);
- adapter.setWorkflowScheduleService(workflowScheduleService);
- assertEquals(adapter.getWorkflowScheduleService(), workflowScheduleService);
- }
-
- @Test
- public void testRegistryAdapterNegCase1() {
- thrown.expect(NullPointerException.class);
+ RegistryAdapter adapter = new RegistryAdapter();
+ adapter.getTriggers();
+ fail("Expecting an exception.");
+ }
- RegistryAdapter adapter = new RegistryAdapter();
- adapter.getTriggers();
- fail("Expecting an exception.");
- }
-
- @Test
- public void testRegistryAdapterNegCase2() {
- thrown.expect(NullPointerException.class);
+ @Test
+ public void testRegistryAdapterNegCase2() {
+ thrown.expect(NullPointerException.class);
- RegistryAdapter adapter = new RegistryAdapter();
- adapter.addCoreTriggers();
- fail("Expecting an exception.");
- }
+ RegistryAdapter adapter = new RegistryAdapter();
+ adapter.addCoreTriggers();
+ fail("Expecting an exception.");
+ }
}
diff --git a/ONAP-SDK-APP/src/test/java/org/onap/portalapp/service/AdminAuthExtensionTest.java b/ONAP-SDK-APP/src/test/java/org/onap/portalapp/service/AdminAuthExtensionTest.java
index 30a38d4ba..116f705bc 100644
--- a/ONAP-SDK-APP/src/test/java/org/onap/portalapp/service/AdminAuthExtensionTest.java
+++ b/ONAP-SDK-APP/src/test/java/org/onap/portalapp/service/AdminAuthExtensionTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2018 AT&T Intellectual Property
* ================================================================================
+ * Modifications Copyright (C) 2019 Samsung
+ * ================================================================================
* 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,10 +22,8 @@
package org.onap.portalapp.service;
import static org.junit.Assert.*;
-
import java.util.SortedSet;
import java.util.TreeSet;
-
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
@@ -33,54 +33,54 @@ import org.onap.portalsdk.core.domain.User;
public class AdminAuthExtensionTest {
- private CommonClassDao commonClassDao;
- private AdminAuthExtension extension;
- private User user;
+ private CommonClassDao commonClassDao;
+ private AdminAuthExtension extension;
+ private User user;
- @Before
- public void setUp(){
- extension = new AdminAuthExtension();
- commonClassDao = Mockito.mock(CommonClassDao.class);
- Mockito.doNothing().when(commonClassDao).updateQuery("");
- Mockito.doNothing().when(commonClassDao).save(new Object());
- extension.setCommonClassDao(commonClassDao);
- user = new User();
- user.setFirstName("Test");
- user.setLoginId("Test");
- }
+ @Before
+ public void setUp() {
+ extension = new AdminAuthExtension();
+ commonClassDao = Mockito.mock(CommonClassDao.class);
+ Mockito.doNothing().when(commonClassDao).updateQuery("");
+ Mockito.doNothing().when(commonClassDao).save(new Object());
+ extension.setCommonClassDao(commonClassDao);
+ user = new User();
+ user.setFirstName("Test");
+ user.setLoginId("Test");
+ }
- @Test
- public void testAdminAuthExtension(){
- try{
- callSaveUserFunction("Policy Super Admin");
- callSaveUserFunction("Policy Super Editor");
- callSaveUserFunction("Policy Super Guest");
- callSaveUserFunction("Policy Admin");
- callSaveUserFunction("Policy Editor");
- callSaveUserFunction("Policy Guest");
- extension.editUserExtension(user);
- extension.saveUserRoleExtension(null, user);
- }catch(Exception e){
- fail("Not Expecting any exception.");
- }
- }
+ @Test
+ public void testAdminAuthExtension() {
+ try {
+ callSaveUserFunction("Policy Super Admin");
+ callSaveUserFunction("Policy Super Editor");
+ callSaveUserFunction("Policy Super Guest");
+ callSaveUserFunction("Policy Admin");
+ callSaveUserFunction("Policy Editor");
+ callSaveUserFunction("Policy Guest");
+ extension.editUserExtension(user);
+ extension.saveUserRoleExtension(null, user);
+ } catch (Exception e) {
+ fail("Not Expecting any exception.");
+ }
+ }
- @Test
- public void expectException(){
- try{
- extension.saveUserExtension(null);
- }catch(Exception e){
- assertEquals(NullPointerException.class, e.getClass());
- }
- }
+ @Test
+ public void expectException() {
+ try {
+ extension.saveUserExtension(null);
+ } catch (Exception e) {
+ assertEquals(NullPointerException.class, e.getClass());
+ }
+ }
- public void callSaveUserFunction(String roleName){
- SortedSet<Role> roles = new TreeSet<>();
- Role role = new Role();
- role.setName(roleName);
- roles.add(role);
- user.setRoles(roles);
- extension.saveUserExtension(user);
- }
+ public void callSaveUserFunction(String roleName) {
+ SortedSet<Role> roles = new TreeSet<>();
+ Role role = new Role();
+ role.setName(roleName);
+ roles.add(role);
+ user.setRoles(roles);
+ extension.saveUserExtension(user);
+ }
}