@@ -0,0 +1,3255 @@
+/*%0A * Copyright 2020 Avast Software, Inc.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *    http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0Apackage com.netflix.spinnaker.clouddriver.controllers;%0A%0Aimport static org.hamcrest.Matchers.emptyString;%0Aimport static org.hamcrest.Matchers.is;%0Aimport static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.asyncDispatch;%0Aimport static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put;%0Aimport static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;%0Aimport static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;%0Aimport static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;%0Aimport static org.springframework.test.web.servlet.setup.MockMvcBuilders.webAppContextSetup;%0A%0Aimport com.fasterxml.jackson.databind.ObjectMapper;%0Aimport com.netflix.spinnaker.clouddriver.Main;%0Aimport com.netflix.spinnaker.kork.artifacts.model.Artifact;%0Aimport org.junit.jupiter.api.BeforeEach;%0Aimport org.junit.jupiter.api.Test;%0Aimport org.junit.jupiter.api.extension.ExtendWith;%0Aimport org.springframework.beans.factory.annotation.Autowired;%0Aimport org.springframework.boot.test.context.SpringBootTest;%0Aimport org.springframework.http.MediaType;%0Aimport org.springframework.test.context.TestPropertySource;%0Aimport org.springframework.test.context.junit.jupiter.SpringExtension;%0Aimport org.springframework.test.context.web.WebAppConfiguration;%0Aimport org.springframework.test.web.servlet.MockMvc;%0Aimport org.springframework.test.web.servlet.MvcResult;%0Aimport org.springframework.web.context.WebApplicationContext;%0A%0A@ExtendWith(SpringExtension.class)%0A@WebAppConfiguration%0A@SpringBootTest(classes = Main.class)%0A@TestPropertySource(%0A    properties = %7B%0A      %22redis.enabled = false%22,%0A      %22sql.enabled = false%22,%0A      %22spring.application.name = clouddriver%22%0A    %7D)%0Apublic class ArtifactControllerSpec %7B%0A%0A  private MockMvc mvc;%0A%0A  @Autowired private WebApplicationContext webApplicationContext;%0A%0A  @Autowired private ObjectMapper objectMapper;%0A%0A  @BeforeEach%0A  public void setup() throws Exception %7B%0A    this.mvc = webAppContextSetup(webApplicationContext).build();%0A  %7D%0A%0A  @Test%0A  public void testFetchWithMisconfiguredArtifact() throws Exception %7B%0A    Artifact misconfiguredArtifact = Artifact.builder().name(%22foo%22).build();%0A    MvcResult result =%0A        mvc.perform(%0A                put(%22/artifacts/fetch%22)%0A                    .contentType(MediaType.APPLICATION_JSON)%0A                    .content(objectMapper.writeValueAsString(misconfiguredArtifact)))%0A            .andReturn();%0A%0A    mvc.perform(asyncDispatch(result))%0A        .andDo(print())%0A        .andExpect(status().isInternalServerError())%0A        .andExpect(content().string(is(emptyString())));%0A  %7D%0A%7D%0A

add test to demonstrate current behavior when fetch… (#5141)