Project

General

Profile

1
package eu.dnetlib.parthenos.publisher;
2

    
3
import org.junit.Test;
4
import org.junit.runner.RunWith;
5
import org.springframework.beans.factory.annotation.Autowired;
6
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
7
import org.springframework.boot.test.mock.mockito.MockBean;
8
import org.springframework.test.context.junit4.SpringRunner;
9
import org.springframework.test.web.servlet.MockMvc;
10

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

    
14
/**
15
 * Created by Alessia Bardi on 29/08/2017.
16
 *
17
 * @author Alessia Bardi
18
 */
19
@RunWith(SpringRunner.class)
20
@WebMvcTest(ParthenosPublisherController.class)
21
public class ParthenosPublisherControllerTest {
22
	@Autowired
23
	private MockMvc mvc;
24

    
25
	@MockBean
26
	private ParthenosPublisherHelper parthenosPublisherHelper;
27

    
28
	@Test
29
	public void publishOK() throws Exception {
30
		mvc.perform(post("/publish").param("record", "<aTestRecord>value</aTestRecord>").param("parthenosTarget", "VIRTUOSO"))
31
				.andExpect(status().isOk());
32
	}
33

    
34
}
(1-1/2)