<commit_before>//package com.faforever.api.map;
//
//import com.faforever.api.FafApiApplication;
//import org.junit.Before;
//import org.junit.Test;
//import org.junit.runner.RunWith;
//import org.springframework.boot.test.SpringApplicationConfiguration;
//import org.springframework.mock.web.MockMultipartFile;
//import org.springframework.test.context.ContextConfiguration;
//import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
//import org.springframework.test.context.web.WebAppConfiguration;
//import org.springframework.test.web.servlet.MockMvc;
//import org.springframework.web.context.WebApplicationContext;
//
//import javax.inject.Inject;
//
//import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.fileUpload;
//import static org.springframework.test.web.servlet.setup.MockMvcBuilders.webAppContextSetup;
//
//@RunWith(SpringJUnit4ClassRunner.class)
//@SpringApplicationConfiguration(classes = FafApiApplication.class)
//@WebAppConfiguration
//// TODO: test_maps_upload_is_metadata_missing
//// TODO: test_maps_upload_no_file_results_400
//// TODO: test_maps_upload_txt_results_400
//public class MapControllerTest {
//
//  private MockMvc mockMvc;
//
//  private WebApplicationContext webApplicationContext;
//
//  @Inject
//  public void Init(WebApplicationContext webApplicationContext) {
//    this.webApplicationContext = webApplicationContext;
//  }
//
//  @Before
//  public void setup() throws Exception {
//    this.mockMvc = webAppContextSetup(webApplicationContext).build();
//  }
//
//  @Test
//  public void jsonMetaDataMissing() throws Exception {
//    MockMultipartFile myMap = new MockMultipartFile("file", "filename.txt", "text/plain", "some xml".getBytes());
//    MockMultipartFile myJson = new MockMultipartFile("json", "", "application/json", "{\"json\": \"someValue\"}".getBytes());
//
//    mockMvc.perform(fileUpload("/maps/upload")
//        .file(myMap)
//        .file(myJson));
//  }
//}<commit_msg>Try to use different test system https://spring.io/blog/2016/04/15/testing-improvements-in-spring-boot-1-4#testing-the-spring-mvc-slice TODO: Fix Authentication for testing<commit_after>package com.faforever.api.map;

import com.faforever.api.config.FafApiProperties;
import com.faforever.api.player.PlayerRepository;
import org.junit.Test;
import org.junit.runner.RunWith;
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.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;

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

@RunWith(SpringRunner.class)
@WebMvcTest(MapsController.class)
// TODO: test_maps_upload_is_metadata_missing
// TODO: test_maps_upload_no_file_results_400
// TODO: test_maps_upload_txt_results_400
public class MapControllerTest {

  @Autowired
  private MockMvc mvc;
  @MockBean
  private PlayerRepository playerRepository;
  @MockBean
  private MapRepository mapRepository;
  @MockBean
  private MapService mapService;
  @MockBean
  private FafApiProperties fafApiProperties;

  @Test
  public void jsonMetaDataMissing() throws Exception {
    // TODO: we need to login
    this.mvc.perform(post("/maps/upload")).andExpect(status().isOk());
  }
}
{'fraction_non_alphanumeric': 0.12660760217204917, 'fraction_numerical': 0.007430694484138326, 'mean_word_length': 5.055363321799308, 'pattern_counts': {'":': 1, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 1}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5710164', 'n_tokens_mistral': 1047, 'n_tokens_neox': 1048, 'n_words': 170}