Revision 57220
Added by Alessia Bardi over 4 years ago
modules/dnet-parthenos-publisher/trunk/test/main/java/eu/dnetlib/parthenos/publisher/ParthenosPublisherControllerTest.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.parthenos.publisher; |
2 | 2 |
|
3 |
import eu.dnetlib.parthenos.jrr.JRRPublisher; |
|
4 |
import eu.dnetlib.parthenos.jrr.JRRPublisherHelper; |
|
3 | 5 |
import org.junit.Test; |
4 | 6 |
import org.junit.runner.RunWith; |
5 | 7 |
import org.springframework.beans.factory.annotation.Autowired; |
... | ... | |
25 | 27 |
@MockBean |
26 | 28 |
private ParthenosPublisherHelper parthenosPublisherHelper; |
27 | 29 |
|
30 |
@MockBean |
|
31 |
private JRRPublisherHelper jrrPublisherHelper; |
|
32 |
|
|
28 | 33 |
@Test |
29 | 34 |
public void publishOK() throws Exception { |
30 | 35 |
mvc.perform(post("/publish").param("record", "<aTestRecord>value</aTestRecord>").param("parthenosTarget", "VIRTUOSO")) |
... | ... | |
32 | 37 |
} |
33 | 38 |
|
34 | 39 |
@Test |
35 |
public void textEx() throws Exception {
|
|
40 |
public void testEx() throws Exception {
|
|
36 | 41 |
mvc.perform(post("/publish")).andExpect(status().is4xxClientError()); |
37 | 42 |
} |
38 | 43 |
|
44 |
@Test |
|
45 |
public void testJRREx() throws Exception { |
|
46 |
mvc.perform(post("/publishJRR")).andExpect(status().is4xxClientError()); |
|
47 |
} |
|
48 |
|
|
49 |
@Test |
|
50 |
public void testJRROk() throws Exception { |
|
51 |
mvc.perform(post("/publishJRR")).andExpect(status().is4xxClientError()); |
|
52 |
} |
|
53 |
|
|
54 |
|
|
55 |
|
|
39 | 56 |
} |
modules/dnet-parthenos-publisher/trunk/src/main/java/eu/dnetlib/parthenos/publisher/ParthenosPublisherController.java | ||
---|---|---|
59 | 59 |
public void setParthenosPublisherHelper(final ParthenosPublisherHelper parthenosPublisherHelper) { |
60 | 60 |
this.parthenosPublisherHelper = parthenosPublisherHelper; |
61 | 61 |
} |
62 |
|
|
63 |
public JRRPublisherHelper getJrrPublisherHelper() { |
|
64 |
return jrrPublisherHelper; |
|
65 |
} |
|
66 |
|
|
67 |
public void setJrrPublisherHelper(JRRPublisherHelper jrrPublisherHelper) { |
|
68 |
this.jrrPublisherHelper = jrrPublisherHelper; |
|
69 |
} |
|
62 | 70 |
} |
Also available in: Unified diff
fixed test which failed in local env for missing mocks and getter/setter