diff options
author | 2019-03-07 15:55:26 -0500 | |
---|---|---|
committer | 2019-03-13 20:34:06 -0400 | |
commit | 2e98a6c64dcdc0891f3729abb045115b790a2c54 (patch) | |
tree | b500d9c108e4eb520a8e00c3f39d7acdfd878728 /ccsdk-app-common/src/test | |
parent | 3df51c6bb79df182be4f0f1bac20bde75f434494 (diff) |
Latest code base
Change-Id: I9549091ebeeabcef2d7af7d91cc394d8371e496b
Issue-ID: CCSDK-1011
Signed-off-by: ramprasad kotagiri <rp5662@att.com>
Diffstat (limited to 'ccsdk-app-common/src/test')
7 files changed, 369 insertions, 236 deletions
diff --git a/ccsdk-app-common/src/test/java/org/onap/ccsdk/dashboard/controller/CloudifyControllerTest.java b/ccsdk-app-common/src/test/java/org/onap/ccsdk/dashboard/controller/CloudifyControllerTest.java new file mode 100644 index 0000000..ff6aa24 --- /dev/null +++ b/ccsdk-app-common/src/test/java/org/onap/ccsdk/dashboard/controller/CloudifyControllerTest.java @@ -0,0 +1,90 @@ +package org.onap.ccsdk.dashboard.controller; + +import static org.junit.Assert.*; + +import org.junit.Before; +import org.junit.Test; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.MockitoAnnotations; +import org.onap.ccsdk.dashboard.core.MockUser; +import org.onap.ccsdk.dashboard.model.CloudifyTenantList; +import org.onap.ccsdk.dashboard.rest.CloudifyClient; +import org.onap.ccsdk.dashboard.core.MockitoTestSuite; +import org.onap.portalsdk.core.domain.User; +import org.onap.portalsdk.core.web.support.UserUtils; +import org.springframework.test.web.servlet.RequestBuilder; +import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.datatype.jdk8.Jdk8Module; +import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; + +import org.springframework.http.MediaType; + + +public class CloudifyControllerTest extends MockitoTestSuite { + + @Mock + private CloudifyClient restClient; + + @InjectMocks + private CloudifyController subject = new CloudifyController(); + + protected final ObjectMapper objectMapper = new ObjectMapper(); + + @Mock + UserUtils userUtils = new UserUtils(); + + @Mock + User epuser; + + MockUser mockUser = new MockUser(); + + @Before + public void setUp() throws Exception { + MockitoAnnotations.initMocks(this); + objectMapper.registerModule(new Jdk8Module()); + } + + @Test + public final void testGetControllerEndpoints_stubbed() { + + } + + @Test + public final void testGetTenants_stubbed() throws Exception { + + String tenantsList = + "{\"items\": [{\"id\": 1, \"name\": \"default_tenant\", \"dName\": \"default_tenant\" }, " + + "{\"id\": 2, \"name\": \"dyh1b1902\", \"dName\": \"dyh1b1902\"}], " + + "\"metadata\": {\"pagination\": {\"total\": 2, \"offset\": 0, \"size\": 0}}}"; + CloudifyTenantList sampleData = null; + try { + sampleData = objectMapper.readValue(tenantsList, CloudifyTenantList.class); + } catch (Exception e) { + } + + User user = mockUser.mockUser(); + user.setLoginId("tester"); + MockHttpServletRequestWrapper mockedRequest = getMockedRequest(); + + Mockito.when(UserUtils.getUserSession(mockedRequest)).thenReturn(user); + Mockito.when(restClient.getTenants()).thenReturn(sampleData); + + RequestBuilder request = MockMvcRequestBuilders. + get("/tenants"). + accept(MediaType.APPLICATION_JSON); + + String tenantStr = + subject.getTenants(mockedRequest); + + assertNotNull(tenantStr); + assertTrue(tenantStr.contains("dyh1b")); + + + } + +} diff --git a/ccsdk-app-common/src/test/java/org/onap/ccsdk/dashboard/core/MockUser.java b/ccsdk-app-common/src/test/java/org/onap/ccsdk/dashboard/core/MockUser.java new file mode 100644 index 0000000..4b68c8e --- /dev/null +++ b/ccsdk-app-common/src/test/java/org/onap/ccsdk/dashboard/core/MockUser.java @@ -0,0 +1,65 @@ +package org.onap.ccsdk.dashboard.core; + +import java.util.Date; + +import org.onap.portalsdk.core.domain.User; + +public class MockUser { + + public User mockUser() { + + User ePUser = new User(); + ePUser.setOrgId(null); + ePUser.setManagerId(null); + ePUser.setFirstName("test"); + ePUser.setLastName("test"); + ePUser.setMiddleInitial(null); + ePUser.setPhone(null); + ePUser.setFax(null); + ePUser.setCellular(null); + ePUser.setEmail(null); + ePUser.setAddressId(null); + ePUser.setAlertMethodCd(null); + ePUser.setHrid(null); + ePUser.setOrgUserId("guestT"); + ePUser.setOrgCode(null); + ePUser.setAddress1(null); + ePUser.setAddress2(null); + ePUser.setCity(null); + ePUser.setState(null); + ePUser.setZipCode(null); + ePUser.setCountry(null); + ePUser.setOrgManagerUserId(null); + ePUser.setLocationClli(null); + ePUser.setBusinessCountryCode(null); + ePUser.setBusinessCountryName(null); + ePUser.setBusinessUnit(null); + ePUser.setBusinessUnitName(null); + ePUser.setDepartment(null); + ePUser.setDepartmentName(null); + ePUser.setCompanyCode(null); + ePUser.setCompany(null); + ePUser.setZipCodeSuffix(null); + ePUser.setJobTitle(null); + ePUser.setCommandChain(null); + ePUser.setSiloStatus(null); + ePUser.setCostCenter(null); + ePUser.setFinancialLocCode(null); + + ePUser.setLoginId(null); + ePUser.setLoginPwd(null); + Date date = new Date(); + ePUser.setLastLoginDate(date); + ePUser.setActive(true); + ePUser.setInternal(false); + ePUser.setSelectedProfileId(null); + ePUser.setTimeZoneId(null); + ePUser.setOnline(true); + ePUser.setChatId(null); + ePUser.setUserApps(null); + ePUser.setPseudoRoles(null); + + ePUser.setId((long) -1); + return ePUser; + } +} diff --git a/ccsdk-app-common/src/test/java/org/onap/ccsdk/dashboard/core/MockitoTestSuite.java b/ccsdk-app-common/src/test/java/org/onap/ccsdk/dashboard/core/MockitoTestSuite.java new file mode 100644 index 0000000..c251a5c --- /dev/null +++ b/ccsdk-app-common/src/test/java/org/onap/ccsdk/dashboard/core/MockitoTestSuite.java @@ -0,0 +1,95 @@ + +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ +package org.onap.ccsdk.dashboard.core; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletRequestWrapper; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mockito; +import org.mockito.runners.MockitoJUnitRunner; + +@RunWith(MockitoJUnitRunner.class) +public class MockitoTestSuite { + + + public MockHttpServletRequestWrapper mockedRequest = new MockHttpServletRequestWrapper( + Mockito.mock(HttpServletRequest.class)); + public HttpServletResponse mockedResponse = Mockito.mock(HttpServletResponse.class); + + public MockHttpServletRequestWrapper getMockedRequest() { + return mockedRequest; + } + + public HttpServletResponse getMockedResponse() { + return mockedResponse; + } + + public class MockHttpServletRequestWrapper extends HttpServletRequestWrapper { + + HttpSession session = Mockito.mock(HttpSession.class); + + public MockHttpServletRequestWrapper(HttpServletRequest request) { + super(request); + + } + + @Override + public HttpSession getSession() { + + return session; + } + + @Override + public HttpSession getSession(boolean create) { + + return session; + } + + } + + @Test + public void test() + { + assert(true); + } +}
\ No newline at end of file diff --git a/ccsdk-app-common/src/test/java/org/onap/ccsdk/dashboard/rest/CloudifyRestClientImplTest.java b/ccsdk-app-common/src/test/java/org/onap/ccsdk/dashboard/rest/CloudifyRestClientImplTest.java new file mode 100644 index 0000000..e7e51cf --- /dev/null +++ b/ccsdk-app-common/src/test/java/org/onap/ccsdk/dashboard/rest/CloudifyRestClientImplTest.java @@ -0,0 +1,119 @@ +package org.onap.ccsdk.dashboard.rest; + +import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Matchers; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.MockitoAnnotations; +import org.onap.ccsdk.dashboard.model.CloudifyErrorCause; +import org.onap.ccsdk.dashboard.model.CloudifyEvent; +import org.onap.ccsdk.dashboard.model.CloudifyEventList; +import org.onap.ccsdk.dashboard.model.CloudifyEventList.Metadata; +import org.onap.ccsdk.dashboard.model.CloudifyTenantList; +import org.springframework.core.ParameterizedTypeReference; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpMethod; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.client.RestClientException; +import org.springframework.web.client.RestTemplate; + +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.datatype.jdk8.Jdk8Module; + +public class CloudifyRestClientImplTest { + + @Mock + RestTemplate mockRest; + + @InjectMocks + CloudifyRestClientImpl subject = + new CloudifyRestClientImpl("https://www.orcl.com/v3.1", "", ""); + + protected final ObjectMapper objectMapper = new ObjectMapper(); + + @Before + public void setUp() throws Exception { + MockitoAnnotations.initMocks(this); + objectMapper.registerModule(new Jdk8Module()); + } + + @Test + public final void getEventlogsTest() throws JsonParseException, JsonMappingException, IOException { + String executionId = "123a123a"; + String tenant = "thisTenant"; + List<CloudifyEvent> items = new ArrayList<CloudifyEvent>(); + CloudifyEvent aMockEvent = new CloudifyEvent("dcae_dtieventproc_idns-k8s-svc-blueprint_02_28_02", "dcae_dtieventproc_idns-k8s-svc-blueprint_02_28_02", + null, "workflow_succeeded", "5f8a2e05-e187-4925-90de-ece9160aa517", "warning", "ctx.7a10e191-f12b-4142-aa5d-6e5766ebb1d4", + "install workflow execution succeeded", "publish_l36bhr", "publish", "cloudify.interfaces.lifecycle.create", + "2019-02-28T23:17:49.228Z", "2019-02-28T23:17:49.700Z", "cloudify_event", "install"); + items.add(aMockEvent); + items.add( + new CloudifyEvent("dcae_dtieventproc_idns-k8s-svc-blueprint_02_28_02", "dcae_dtieventproc_idns-k8s-svc-blueprint_02_28_02", + null, "workflow_node_event", "5f8a2e05-e187-4925-90de-ece9160aa517", "warning", "ctx.7a10e191-f12b-4142-aa5d-6e5766ebb1d4", + "Starting node", "publish_l36bhr", "publish", "cloudify.interfaces.lifecycle.create", + "2019-02-28T23:17:48.391Z", "2019-02-28T23:17:48.516Z", "cloudify_event", "install")); + + String metaInfo = "metadata\": {\"pagination\": {\"total\": 2, \"offset\": 0, \"size\": 0}}"; + Metadata metadata = null; + //metadata = objectMapper.readValue(metaInfo, Metadata.class); + + CloudifyEventList expected = new CloudifyEventList(items, metadata); + + ResponseEntity<CloudifyEventList> response = new ResponseEntity<CloudifyEventList>(expected, HttpStatus.OK); + Mockito.when(mockRest.exchange(Matchers.anyString(), Matchers.eq(HttpMethod.GET), Matchers.<HttpEntity<?>>any(), + Matchers.<ParameterizedTypeReference<CloudifyEventList>>any())).thenReturn(response); + CloudifyEventList actual = subject.getEventlogs(executionId, tenant); + + assertTrue(actual.items.size() == 2); + + } + @Test + public final void testGetTenants_GetData() { + // define the entity you want the exchange to return + String tenantsList = "{\"items\": [{\"id\": 1, \"dName\": null, \"name\": \"default_tenant\"}, {\"id\": 2, \"dName\": null, \"name\": \"dyh1b1902\"}], \"metadata\": {\"pagination\": {\"total\": 2, \"offset\": 0, \"size\": 0}}}"; + CloudifyTenantList sampleData = null; + try { + sampleData = objectMapper.readValue(tenantsList, CloudifyTenantList.class); + } catch (Exception e) { + } + + ResponseEntity<CloudifyTenantList> response = new ResponseEntity<CloudifyTenantList>(sampleData, HttpStatus.OK); + Mockito.when(mockRest.exchange(Matchers.anyString(), Matchers.eq(HttpMethod.GET), Matchers.<HttpEntity<?>>any(), + Matchers.<ParameterizedTypeReference<CloudifyTenantList>>any())).thenReturn(response); + + CloudifyTenantList res = subject.getTenants(); + assertNotNull(res); + assertThat(res.items.get(1).name, is("dyh1b1902")); + // Assert.assertEquals(myobjectA, res.get(0)); + } + + @Test(expected = RestClientException.class) + public final void testGetTenants_withException() { + // define the entity you want the exchange to return + Mockito.when(mockRest.exchange(Matchers.anyString(), Matchers.eq(HttpMethod.GET), Matchers.<HttpEntity<?>>any(), + Matchers.<ParameterizedTypeReference<CloudifyTenantList>>any())).thenThrow(RestClientException.class); + + subject.getTenants(); + + + } +} diff --git a/ccsdk-app-common/src/test/java/org/onap/fusion/core/MockApplicationContextTestSuite.java b/ccsdk-app-common/src/test/java/org/onap/fusion/core/MockApplicationContextTestSuite.java deleted file mode 100644 index ccefdce..0000000 --- a/ccsdk-app-common/src/test/java/org/onap/fusion/core/MockApplicationContextTestSuite.java +++ /dev/null @@ -1,137 +0,0 @@ -/*******************************************************************************
- * =============LICENSE_START=========================================================
- *
- * =================================================================================
- * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- *******************************************************************************/
-package org.onap.fusion.core;
-
-import java.io.IOException;
-
-import org.junit.Before;
-import org.junit.runner.RunWith;
-import org.onap.portalsdk.core.conf.AppConfig;
-import org.onap.portalsdk.core.objectcache.AbstractCacheManager;
-import org.onap.portalsdk.core.util.CacheManager;
-import org.onap.portalsdk.core.util.SystemProperties;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.ComponentScan;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Profile;
-import org.springframework.test.context.ActiveProfiles;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import org.springframework.test.context.web.AnnotationConfigWebContextLoader;
-import org.springframework.test.context.web.WebAppConfiguration;
-import org.springframework.test.web.servlet.MockMvc;
-import org.springframework.test.web.servlet.setup.MockMvcBuilders;
-import org.springframework.web.context.WebApplicationContext;
-import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
-
-/**
- * In order to write a unit test, 1. inherit this class - See SanityTest.java 2.
- * place the "war" folder on your test class's classpath 3. run the test with
- * the following VM argument; This is important because when starting the
- * application from Container, the System Properties file
- * (SystemProperties.java) can have the direct path but, when running from the
- * Mock Junit container, the path should be prefixed with "classpath" to enable
- * the mock container to search for the file in the classpath
- * -Dcontainer.classpath="classpath:"
- *
- */
-
-@RunWith(SpringJUnit4ClassRunner.class)
-@WebAppConfiguration
-@ContextConfiguration(loader = AnnotationConfigWebContextLoader.class, classes = { MockAppConfig.class })
-@ActiveProfiles(value = "test")
-public class MockApplicationContextTestSuite {
-
- @Autowired
- public WebApplicationContext wac;
-
- private MockMvc mockMvc;
-
- @Before
- public void setup() {
- if (mockMvc == null) {
- this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build();
-
- }
- }
-
- public Object getBean(String name) {
- return this.wac.getBean(name);
- }
-
- public MockMvc getMockMvc() {
- return mockMvc;
- }
-
- public void setMockMvc(MockMvc mockMvc) {
- this.mockMvc = mockMvc;
- }
-
- public WebApplicationContext getWebApplicationContext() {
- return wac;
- }
-
-}
-
-@Configuration
-@ComponentScan(basePackages = {"org.openecomp", "org.onap"}, excludeFilters = {
- // see AppConfig class
-})
-@Profile("test")
-class MockAppConfig extends AppConfig {
-
- @Bean
- public SystemProperties systemProperties() {
- return new MockSystemProperties();
- }
-
- @Bean
- public AbstractCacheManager cacheManager() {
- return new CacheManager() {
-
- public void configure() throws IOException {
-
- }
- };
- }
-
- protected String[] tileDefinitions() {
- return new String[] { "classpath:/WEB-INF/fusion/defs/definitions.xml",
- "classpath:/WEB-INF/defs/definitions.xml" };
- }
-
- @Override
- public void addInterceptors(InterceptorRegistry registry) {
- // registry.addInterceptor(new
- // SessionTimeoutInterceptor()).excludePathPatterns(getExcludeUrlPathsForSessionTimeout());
- // registry.addInterceptor(resourceInterceptor());
- }
-
- public static class MockSystemProperties extends SystemProperties {
-
- public MockSystemProperties() {
- }
-
- }
-
-}
diff --git a/ccsdk-app-common/src/test/java/org/onap/fusionapp/SanityTest.java b/ccsdk-app-common/src/test/java/org/onap/fusionapp/SanityTest.java deleted file mode 100644 index c859c28..0000000 --- a/ccsdk-app-common/src/test/java/org/onap/fusionapp/SanityTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * =============LICENSE_START========================================================= - * - * ================================================================================= - * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. - *******************************************************************************/ -package org.onap.fusionapp; - -import org.junit.Assert; -import org.junit.Test; -import org.onap.fusion.core.MockApplicationContextTestSuite; -import org.springframework.test.web.servlet.ResultActions; -import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; - -public class SanityTest extends MockApplicationContextTestSuite { - - @Test - public void testGetAvailableRoles() throws Exception { - - ResultActions ra =getMockMvc().perform(MockMvcRequestBuilders.get("/api/roles")); - //Assert.assertEquals(UrlAccessRestrictedException.class,ra.andReturn().getResolvedException().getClass()); - Assert.assertEquals("application/json",ra.andReturn().getResponse().getContentType()); - } - - -} diff --git a/ccsdk-app-common/src/test/java/org/onap/fusionapp/service/ProfileServiceTest.java b/ccsdk-app-common/src/test/java/org/onap/fusionapp/service/ProfileServiceTest.java deleted file mode 100644 index ce00583..0000000 --- a/ccsdk-app-common/src/test/java/org/onap/fusionapp/service/ProfileServiceTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/*******************************************************************************
- * =============LICENSE_START=========================================================
- *
- * =================================================================================
- * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- *******************************************************************************/
-package org.onap.fusionapp.service;
-
-import java.util.List;
-
-import org.junit.Assert;
-import org.junit.Test;
-import org.onap.fusion.core.MockApplicationContextTestSuite;
-import org.onap.portalsdk.core.domain.Profile;
-import org.onap.portalsdk.core.domain.User;
-import org.onap.portalsdk.core.service.ProfileService;
-import org.onap.portalsdk.core.service.UserProfileService;
-import org.springframework.beans.factory.annotation.Autowired;
-
-
-public class ProfileServiceTest extends MockApplicationContextTestSuite {
-
- @Autowired
- ProfileService service;
-
- @Autowired
- UserProfileService userProfileService;
-
- @Test
- public void testFindAll() throws Exception {
-
- List<Profile> profiles = service.findAll();
- Assert.assertTrue(profiles.size() > 0);
- }
-
- @Test
- public void testFindAllActive() {
-
- List<User> users = userProfileService.findAllActive();
- List<User> activeUsers = userProfileService.findAllActive();
- Assert.assertTrue(users.size() - activeUsers.size() >= 0);
- }
-}
|