Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
mherman22 committed Nov 19, 2024
1 parent 8599dbd commit e09e9d1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ protected BaseWebContextSensitiveTest(List<String[]> tablesToRestore) {
this.tablesToRestore = tablesToRestore != null ? tablesToRestore : new ArrayList<>();
}

protected void setUp() {
protected void setUp() throws Exception {
mockMvc = MockMvcBuilders.webAppContextSetup(this.webApplicationContext).build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@
import org.openelisglobal.dictionarycategory.valueholder.DictionaryCategory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.test.annotation.Rollback;
import org.springframework.test.web.servlet.MvcResult;

@Rollback
public class DictionaryMenuRestControllerTest extends BaseWebContextSensitiveTest {

@Autowired
Expand All @@ -32,8 +34,9 @@ public class DictionaryMenuRestControllerTest extends BaseWebContextSensitiveTes

@Before
@Override
public void setUp() {
public void setUp() throws Exception {
super.setUp();
executeDataSetWithStateManagement("testdata/dictionary.xml");
}

@Test
Expand All @@ -47,9 +50,9 @@ public void getDictionaryMenuList_shouldReturnDictionaryMenu() throws Exception
List<DictionaryMenuForm> menuList = Arrays.asList(super.mapFromJson(content, DictionaryMenuForm[].class));
assertThat(menuList.get(0).getMenuList().get(0).getId(), is("1"));
assertThat(menuList.get(0).getMenuList().get(0).getIsActive(), is("Y"));
assertThat(menuList.get(0).getMenuList().get(0).getDictEntry(), is("INFLUENZA VIRUS A RNA DETECTED"));
assertThat(menuList.get(0).getMenuList().get(0).getSortOrder(), is(100));
assertThat(menuList.get(0).getMenuList().get(0).getDictionaryCategory().getCategoryName(), is("CG"));
assertThat(menuList.get(0).getMenuList().get(0).getDictEntry(), is("Dictionary Entry 1"));
assertThat(menuList.get(0).getMenuList().get(0).getSortOrder(), is(1));
assertThat(menuList.get(0).getMenuList().get(0).getDictionaryCategory().getCategoryName(), is("Category Name 1"));
}

@Test
Expand All @@ -64,26 +67,6 @@ public void fetchDictionaryCategories_shouldFetchDictionaryDescriptions() throws
assertThat(menuList, notNullValue());
}

// TODO: To be looked into later

// @Test
// public void createDictionary_shouldSuccessfullyCreateDictionary() throws
// Exception {
// Dictionary dictionary = createDictionaryObject();
// String toJson = super.mapToJson(dictionary);
//
// MvcResult mvcResult = super.mockMvc.perform(
// post("/rest/dictionary")
// .accept(MediaType.APPLICATION_JSON_VALUE)
// .contentType(MediaType.APPLICATION_JSON_VALUE)
// .content(toJson)).andReturn();
//
// int status = mvcResult.getResponse().getStatus();
// assertEquals(201, status);
// String content = mvcResult.getResponse().getContentAsString();
// assertEquals(content, "Dictionary created successfully");
// }

@Test
public void showDeleteDictionary_shouldSuccessfullyDeleteDictionary() throws Exception {
MvcResult getMenu = super.mockMvc.perform(get("/rest/DictionaryMenu").accept(MediaType.APPLICATION_JSON_VALUE)
Expand Down

0 comments on commit e09e9d1

Please sign in to comment.