package <%= packageName %>.web.rest;

import io.github.jhipster.config.JHipsterProperties;
<%_ if (databaseType === 'cassandra') { _%>
import <%= packageName %>.AbstractCassandraTest;
<%_ } _%>
import <%= packageName %>.<%= mainClass %>;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.MockitoAnnotations;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.core.env.Environment;
import org.springframework.http.MediaType;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;

import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;

/**
 * Test class for the ProfileInfoResource REST controller.
 *
 * @see ProfileInfoResource
 **/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = <%= mainClass %>.class)
public class ProfileInfoResourceIntTest <% if (databaseType === 'cassandra') { %>extends AbstractCassandraTest <% } %>{

    @Autowired
    private Environment environment;

    @Autowired
    private JHipsterProperties jHipsterProperties;

    private MockMvc restProfileMockMvc;

    @Before
    public void setup() {
        MockitoAnnotations.initMocks(this);

        ProfileInfoResource profileInfoResource = new ProfileInfoResource(environment, jHipsterProperties);
        this.restProfileMockMvc = MockMvcBuilders
            .standaloneSetup(profileInfoResource)
            .build();
    }

    @Test
    public void getProfileInfo()throws Exception {
        restProfileMockMvc.perform(get("/api/profile-info"))
            .andExpect(status().isOk())
            .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE));
    }
}

@@ -312,16 +312,41 @@
 unWith;%0A
+import org.mockito.Mock;%0A
 import o
@@ -774,16 +774,56 @@
 lders;%0A%0A
+import static org.mockito.Mockito.when;%0A
 import s
@@ -1379,33 +1379,28 @@
 %7D %25%3E%7B%0A%0A    @
-Autowired
+Mock
 %0A    private
@@ -1431,25 +1431,20 @@
 ;%0A%0A    @
-Autowired
+Mock
 %0A    pri
@@ -1610,16 +1610,448 @@
 s(this);
+%0A        String mockProfile%5B%5D = %7B%22test%22%7D;%0A        JHipsterProperties.Ribbon ribbon = new JHipsterProperties.Ribbon();%0A        ribbon.setDisplayOnActiveProfiles(mockProfile);%0A        when(jHipsterProperties.getRibbon()).thenReturn(ribbon);%0A%0A        String activeProfiles%5B%5D = %7B%22test%22%7D;%0A        when(environment.getDefaultProfiles()).thenReturn(activeProfiles);%0A        when(environment.getActiveProfiles()).thenReturn(activeProfiles);
 %0A%0A      
@@ -2321,18 +2321,29 @@
 fileInfo
+WithRibbon
 ()
+ 
 throws E
@@ -2545,11 +2545,930 @@
 );%0A    %7D
+%0A%0A    @Test%0A    public void getProfileInfoWithoutRibbon() throws Exception %7B%0A        JHipsterProperties.Ribbon ribbon = new JHipsterProperties.Ribbon();%0A        ribbon.setDisplayOnActiveProfiles(null);%0A        when(jHipsterProperties.getRibbon()).thenReturn(ribbon);%0A%0A        restProfileMockMvc.perform(get(%22/api/profile-info%22))%0A            .andExpect(status().isOk())%0A            .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE));%0A    %7D%0A%0A    @Test%0A    public void getProfileInfoWithoutActiveProfiles() throws Exception %7B%0A        String emptyProfile%5B%5D = %7B%7D;%0A        when(environment.getDefaultProfiles()).thenReturn(emptyProfile);%0A        when(environment.getActiveProfiles()).thenReturn(emptyProfile);%0A%0A        restProfileMockMvc.perform(get(%22/api/profile-info%22))%0A            .andExpect(status().isOk())%0A            .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE));%0A    %7D
 %0A%7D%0A

Improve integration test for profile info resource