use of com.albedo.java.modules.sys.domain.DictDo 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.DictDo in project albedo by somowhere.
the class DictDoResourceIntTest method createDict.
@Test
@Transactional(rollbackFor = Exception.class)
public void createDict() throws Exception {
List<DictDo> databaseSizeBeforeCreate = dictService.list();
// Create the Dict
restDictMockMvc.perform(post(DEFAULT_API_URL).contentType(TestUtil.APPLICATION_JSON_UTF8).content(TestUtil.convertObjectToJsonBytes(dict))).andExpect(status().isOk());
// Validate the Dict in the database
List<DictDo> dictDoList = dictService.list();
assertThat(dictDoList).hasSize(databaseSizeBeforeCreate.size() + 1);
DictDo testDictDo = dictService.getOne(Wrappers.<DictDo>query().lambda().eq(DictDo::getName, dict.getName()));
assertThat(testDictDo.getName()).isEqualTo(DEFAULT_NAME);
assertThat(testDictDo.getCode()).isEqualTo(DEFAULT_CODE);
assertThat(testDictDo.getVal()).isEqualTo(DEFAULT_VAL);
assertThat(testDictDo.getSort()).isEqualTo(DEFAULT_SORT);
assertThat(testDictDo.getParentId()).isEqualTo(anotherDict.getId());
assertThat(testDictDo.getParentIds()).contains(String.valueOf(anotherDict.getId()));
assertThat(testDictDo.isLeaf()).isEqualTo(true);
assertThat(testDictDo.getDescription()).isEqualTo(DEFAULT_DESCRIPTION);
assertThat(testDictDo.getDelFlag()).isEqualTo(DictDo.FLAG_NORMAL);
}
use of com.albedo.java.modules.sys.domain.DictDo in project albedo by somowhere.
the class DictDoResourceIntTest method testDictEquals.
@Test
@Transactional(rollbackFor = Exception.class)
public void testDictEquals() throws Exception {
TestUtil.equalsVerifier(DictDo.class);
DictDo dictDo1 = new DictDo();
dictDo1.setId(1L);
dictDo1.setName("Dict1");
DictDo dictDo2 = new DictDo();
dictDo2.setId(dictDo1.getId());
dictDo2.setName(dictDo1.getName());
assertThat(dictDo1).isEqualTo(dictDo2);
dictDo2.setId(2L);
dictDo2.setName("Dict2");
assertThat(dictDo1).isNotEqualTo(dictDo2);
dictDo1.setId(null);
assertThat(dictDo1).isNotEqualTo(dictDo2);
}
use of com.albedo.java.modules.sys.domain.DictDo 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.DictDo 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