Skip to content

Write test for actuator #701

@clemens-tolboom

Description

@clemens-tolboom
package org.molgenis.armadillo;

import org.junit.jupiter.api.Test;
import org.molgenis.armadillo.controller.ArmadilloControllerTestBase;
import org.molgenis.armadillo.controller.CurrentUserController;
import org.molgenis.armadillo.storage.ArmadilloStorageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.context.annotation.Import;
import org.springframework.security.test.context.support.WithMockUser;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;

@WebMvcTest(CurrentUserController.class)
@Import({TestSecurityConfig.class})
public class ActuatorEndpointTest  extends ArmadilloControllerTestBase {

    @MockBean
    ArmadilloStorageService armadilloStorage;

    @Autowired
    private MockMvc mockMvc;

    @Test
    @WithMockUser(roles = "SU")
    public void testActuatorEndpoint() throws Exception {
        mockMvc.perform(MockMvcRequestBuilders.get("/actuator"))
                .andExpect(MockMvcResultMatchers.status().isOk());
    }
}

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions