+++ /dev/null
-/*-\r
- * ========================LICENSE_START=================================\r
- * O-RAN-SC\r
- * %%\r
- * Copyright (C) 2023 OpenInfra Foundation Europe.\r
- * %%\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ========================LICENSE_END===================================\r
- */\r
-\r
-package org.oran.helloworld.rest;\r
-\r
-import org.junit.jupiter.api.Test;\r
-import org.springframework.beans.factory.annotation.Autowired;\r
-import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;\r
-import org.springframework.boot.test.mock.mockito.MockBean;\r
-import org.springframework.test.web.servlet.MockMvc;\r
-\r
-import static org.mockito.Mockito.when;\r
-import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;\r
-import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;\r
-\r
-@WebMvcTest(HelloWorldController.class)\r
-public class HelloWorldControllerTest {\r
-\r
- @Autowired\r
- private MockMvc mockMvc;\r
-\r
- @MockBean\r
- private HelloWorldController helloWorldController;\r
-\r
- @Test\r
- public void testHelloWorldEndpoint() throws Exception {\r
- when(helloWorldController.helloWorld()).thenReturn("Hello World from service stub\n");\r
-\r
- mockMvc.perform(get("/v1/helloworld"))\r
- .andExpect(status().isOk())\r
- .andExpect(content().string("Hello World from service stub\n"));\r
- }\r
-\r
- @Test\r
- public void testHelloWorldSmeEndpoint() throws Exception {\r
- when(helloWorldController.helloWorldSme()).thenReturn("Hello World from SME\n");\r
-\r
- mockMvc.perform(get("/v1/helloworld/sme"))\r
- .andExpect(status().isOk())\r
- .andExpect(content().string("Hello World from SME\n"));\r
- }\r
-}\r