package io.crowdcode.flaschenlager.product.controller;


import io.crowdcode.flaschenlager.product.model.Product;
import io.crowdcode.flaschenlager.product.repository.ProductRepository;
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.http.MediaType;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;

import static org.mockito.Mockito.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;

@RunWith(SpringRunner.class)
@WebMvcTest(ProductController.class)
public class ProductControllerTest {

    private static final String PRODUCT_JSON = "{ \"amount\": 0, \"description\": \"string\", \"name\": \"string\", \"unit\": \"string\", \"version\": 0}";

    private static final String PASSWORD_JSON = "{\"oldPassword\":\"secret2\",\"newPassword\":\"ZYX\"}";

    @Autowired
    private MockMvc mvc;

    @MockBean
    private ProductRepository productRepository;


    @Test
    public void testCreateProduct() throws Exception {
        mvc.perform(MockMvcRequestBuilders.post("/product").content(PRODUCT_JSON)
                .contentType(MediaType.APPLICATION_JSON)
                .accept(MediaType.APPLICATION_JSON)).andExpect(status().isCreated());

        verify(productRepository, times(1)).save(any(Product.class));
    }


}
@@ -1058,114 +1058,8 @@
 %22;%0A%0A
-    private static final String PASSWORD_JSON = %22%7B%5C%22oldPassword%5C%22:%5C%22secret2%5C%22,%5C%22newPassword%5C%22:%5C%22ZYX%5C%22%7D%22;%0A%0A
     

remove dead code