use of com.albedo.java.modules.sys.domain.dto.DictDto in project albedo by somowhere.
the class DictDoResourceIntTest method createEntity.
/**
* Create a Dict.
* <p>
* This is a static method, as tests for other entities might also need it, if they
* test an domain which has a required relationship to the Dict domain.
*/
public DictDto createEntity() {
DictDto dict = new DictDto();
dict.setName(DEFAULT_NAME);
dict.setVal(DEFAULT_VAL);
dict.setCode(DEFAULT_CODE);
dict.setSort(DEFAULT_SORT);
dict.setRemark(DEFAULT_REMARK);
dict.setDescription(DEFAULT_DESCRIPTION);
return dict;
}
use of com.albedo.java.modules.sys.domain.dto.DictDto in project albedo by somowhere.
the class DictDoResourceIntTest method updateDictExistingCode.
@Test
@Transactional(rollbackFor = Exception.class)
public void updateDictExistingCode() throws Exception {
dictService.saveOrUpdate(dict);
// Update the dict
DictDo updatedDictDo = dictService.getById(dict.getId());
DictDto managedDictVM = new DictDto();
managedDictVM.setName(DEFAULT_ANOTHER_NAME);
managedDictVM.setVal(DEFAULT_ANOTHER_VAL);
managedDictVM.setParentId(DEFAULT_ANOTHER_PARENT_ID);
managedDictVM.setCode(DEFAULT_ANOTHER_CODE);
managedDictVM.setSort(DEFAULT_SORT);
managedDictVM.setRemark(DEFAULT_REMARK);
managedDictVM.setDescription(DEFAULT_DESCRIPTION);
managedDictVM.setId(updatedDictDo.getId());
restDictMockMvc.perform(post(DEFAULT_API_URL).contentType(TestUtil.APPLICATION_JSON_UTF8).content(TestUtil.convertObjectToJsonBytes(managedDictVM))).andExpect(status().isOk()).andExpect(jsonPath("$.code").value(ResponseCode.FAIL.getCode())).andExpect(jsonPath("$.message").isNotEmpty());
// Update the dict
DictDo updatedDictAfterDo = dictService.getById(dict.getId());
assertThat(updatedDictAfterDo.getCode()).isEqualTo(updatedDictDo.getCode());
}
use of com.albedo.java.modules.sys.domain.dto.DictDto in project albedo by somowhere.
the class DictDoResourceIntTest method createDictWithExistingCode.
@Test
@Transactional(rollbackFor = Exception.class)
public void createDictWithExistingCode() throws Exception {
// Initialize the database
dictService.saveOrUpdate(dict);
int databaseSizeBeforeCreate = dictService.list().size();
// Create the Dict
DictDto managedDictVM = createEntity();
// Create the Dict
restDictMockMvc.perform(post(DEFAULT_API_URL).contentType(TestUtil.APPLICATION_JSON_UTF8).content(TestUtil.convertObjectToJsonBytes(managedDictVM))).andExpect(status().isOk()).andExpect(jsonPath("$.code").value(ResponseCode.FAIL.getCode())).andExpect(jsonPath("$.message").isNotEmpty());
// Validate the Dict in the database
List<DictDo> dictDoList = dictService.list();
assertThat(dictDoList).hasSize(databaseSizeBeforeCreate);
}
use of com.albedo.java.modules.sys.domain.dto.DictDto in project albedo by somowhere.
the class DictDoResourceIntTest method updateDict.
@Test
@Transactional(rollbackFor = Exception.class)
public void updateDict() throws Exception {
// Initialize the database
dictService.saveOrUpdate(dict);
int databaseSizeBeforeUpdate = dictService.list().size();
// Update the dict
DictDo updatedDictDo = dictService.getById(dict.getId());
DictDto managedDictVM = new DictDto();
managedDictVM.setName(UPDATED_NAME);
managedDictVM.setCode(UPDATED_CODE);
managedDictVM.setVal(UPDATED_VAL);
managedDictVM.setSort(UPDATED_SORT);
managedDictVM.setParentId(UPDATED_PARENT_ID);
managedDictVM.setRemark(UPDATED_REMARK);
managedDictVM.setDescription(UPDATED_DESCRIPTION);
managedDictVM.setId(updatedDictDo.getId());
restDictMockMvc.perform(post(DEFAULT_API_URL).contentType(TestUtil.APPLICATION_JSON_UTF8).content(TestUtil.convertObjectToJsonBytes(managedDictVM))).andExpect(status().isOk()).andExpect(jsonPath("$.code").value(CommonConstants.SUCCESS));
// Validate the Dict in the database
List<DictDo> dictDoList = dictService.list();
assertThat(dictDoList).hasSize(databaseSizeBeforeUpdate);
DictDo testDictDo = dictService.getById(updatedDictDo.getId());
assertThat(testDictDo.getName()).isEqualTo(UPDATED_NAME);
assertThat(testDictDo.getCode()).isEqualTo(UPDATED_CODE);
assertThat(testDictDo.getVal()).isEqualTo(UPDATED_VAL);
assertThat(testDictDo.getSort()).isEqualTo(UPDATED_SORT);
assertThat(testDictDo.getParentId()).isEqualTo(UPDATED_PARENT_ID);
// assertThat(testDict.getParentIds()).contains(UPDATED_PARENT_ID);
assertThat(testDictDo.isLeaf()).isEqualTo(true);
assertThat(testDictDo.getDescription()).isEqualTo(UPDATED_DESCRIPTION);
assertThat(testDictDo.getDelFlag()).isEqualTo(DictDo.FLAG_NORMAL);
}
Aggregations