ile karşılaştır. Testlerim tamamlanmalı ve yeşil gitmeli. Yardıma ihtiyacım olan gerçekten küçük bir sorundur.Mockito Rest End Point Testing - Testlerim
@ContextConfiguration(locations = { "classpath:integrator-rest.xml" })
@RunWith(SpringJUnit4ClassRunner.class)
@WebAppConfiguration
public class ProjectBuilderControllerTest {
@Mock
private ProjectBuilderController projectBuilderControllerMock;
@Autowired
private WebApplicationContext webApplicationContext;
private MockMvc mockMvc;
/**
* @throws java.lang.Exception
*/
@Before
public void setUp() throws Exception {
mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).build();
MockitoAnnotations.initMocks(this);
}
@Test
public void loadDependencyListMockTest() throws Exception {
ArrayList<String> result = new ArrayList<String>();
result.add("spring-core-3.0.1");
result.add("spring-webmvc-4.2.1");
result.add("spring-test-4.0.1");
result.add("junit-4.1");
mockMvc.perform(get("/projectbuilder/dependencyList")).andExpect(status().isOk());
mockMvc.perform(get("/projectbuilder/dependencyList").accept(MediaType.APPLICATION_JSON_UTF8))
.andExpect(status().isOk())
.andExpect(jsonPath("$", Matchers.hasSize(5)))
.andExpect(jsonPath("$", Matchers.equalTo((result))));
}
/**
* @throws java.lang.Exception
*/
@After
public void tearDown() throws Exception {
mockMvc = null;
}
}
Test/geçiş yapmak için sadece eklemek/kaldırmak istiyorum. Bağımlılık listemi yüklediğim ve listeyi döndürdüğüm xml dosyasının bağlantısı.
Temel olarak, loadDependencyList() yöntemi, XML Dosyasından bir bağımlılıklar listesi yükler ve bağımlılıklar listesini döndürür, yalnızca döndürülen listenin tutarlı olduğunu test ediyorum.
TEST ŞİMDİ GEÇMEKTEDİR! SORUNUN SİPARİŞİNİN SİPARİŞ OLDUĞU SORUNU