- logger.info("setUp: exit");
- }
-
- public List<Object> testDescriptiveScope(){
- List<Object> objectData = new ArrayList<>();
-
- DescriptiveScope data = new DescriptiveScope();
- data.setId(1);
- assertTrue(1 == data.getId());
- data.setScopeName("Test");
- assertTrue("Test".equals(data.getScopeName()));
- data.setDescription("Test");
- assertTrue("Test".equals(data.getDescription()));
- data.setSearch("Test");
- assertTrue("Test".equals(data.getSearch()));
- data.setCreatedDate(new Date());
- assertTrue(data.getCreatedDate()!= null);
- data.setModifiedDate(new Date());
- assertTrue(data.getModifiedDate()!= null);
- data.setUserCreatedBy(userInfo);
- assertTrue(data.getUserCreatedBy()!= null);
- data.setUserModifiedBy(userInfo);
- assertTrue(data.getUserModifiedBy()!= null);
- objectData.add(data);
-
- return objectData;
- }
-
- @Test
- public void testGetDescriptiveDictionaryByNameEntityData(){
- when(commonClassDao.getDataByColumn(DescriptiveScope.class, "descriptiveScopeName")).thenReturn(data);
- controller.getDescriptiveDictionaryByNameEntityData(response);
- try {
- assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("descriptiveScopeDictionaryDatas"));
- } catch (Exception e) {
- fail();
- logger.error(e.getMessage(),e);
- }
- }
-
- @Test
- public void testGetDescriptiveDictionaryEntityData(){
- when(commonClassDao.getData(DescriptiveScope.class)).thenReturn(testDescriptiveScope());
- controller.getDescriptiveDictionaryEntityData(response);
- try {
- assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("descriptiveScopeDictionaryDatas"));
- } catch (Exception e) {
- fail();
- logger.error(e.getMessage(),e);
- }
- }
-
- @Test
- public void testSaveDescriptiveDictionary(){
- jsonString = "{\"descriptiveScopeDictionaryData\":{\"attributes\":[{\"$$hashKey\":\"object:257\",\"id\":\"choice1\",\"number\":\"12\",\"option\":\"test\"}],\"description\":\"test\",\"descriptiveScopeName\":\"Test\",\"search\":\"Test\"},\"userid\":\"demo\"}";
- try(BufferedReader br = new BufferedReader(new StringReader(jsonString))){
- when(request.getReader()).thenReturn(br);
- controller.saveDescriptiveDictionary(request, response);
- assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("descriptiveScopeDictionaryDatas"));
- }catch(Exception e){
- logger.error("Exception"+ e);
- }
- }
-
- @Test
- public void testUpdateDescriptiveDictionary(){
- jsonString = "{\"descriptiveScopeDictionaryData\":{\"attributes\":[{\"$$hashKey\":\"object:257\",\"id\":\"choice1\",\"number\":\"12\",\"option\":\"test\"}],\"description\":\"test\",\"descriptiveScopeName\":\"Test\",\"id\":1,\"search\":\"Test\"},\"userid\":\"demo\"}";
- try(BufferedReader br = new BufferedReader(new StringReader(jsonString))){
- when(request.getReader()).thenReturn(br);
- controller.saveDescriptiveDictionary(request, response);
- assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("descriptiveScopeDictionaryDatas"));
- }catch(Exception e){
- logger.error("Exception"+ e);
- }
- }
-
- @Test
- public void testRemoveDescriptiveDictionary(){
- jsonString = "{\"data\":{\"attributes\":[{\"$$hashKey\":\"object:257\",\"id\":\"choice1\",\"number\":\"12\",\"option\":\"test\"}],\"description\":\"test\",\"descriptiveScopeName\":\"Test\",\"id\":1,\"search\":\"Test\"},\"userid\":\"demo\"}";
- try(BufferedReader br = new BufferedReader(new StringReader(jsonString))){
- when(request.getReader()).thenReturn(br);
- controller.removeDescriptiveDictionary(request, response);
- assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("descriptiveScopeDictionaryDatas"));
- }catch(Exception e){
- logger.error("Exception"+ e);
- }
- }
-}
\ No newline at end of file
+ logger.info("setUp: exit");
+ }
+
+ public List<Object> testDescriptiveScope() {
+ List<Object> objectData = new ArrayList<>();
+
+ DescriptiveScope data = new DescriptiveScope();
+ data.setId(1);
+ assertTrue(1 == data.getId());
+ data.setScopeName("Test");
+ assertTrue("Test".equals(data.getScopeName()));
+ data.setDescription("Test");
+ assertTrue("Test".equals(data.getDescription()));
+ data.setSearch("Test");
+ assertTrue("Test".equals(data.getSearch()));
+ data.setCreatedDate(new Date());
+ assertTrue(data.getCreatedDate() != null);
+ data.setModifiedDate(new Date());
+ assertTrue(data.getModifiedDate() != null);
+ data.setUserCreatedBy(userInfo);
+ assertTrue(data.getUserCreatedBy() != null);
+ data.setUserModifiedBy(userInfo);
+ assertTrue(data.getUserModifiedBy() != null);
+ objectData.add(data);
+
+ return objectData;
+ }
+
+ @Test
+ public void testGetDescriptiveDictionaryByNameEntityData() {
+ when(commonClassDao.getDataByColumn(DescriptiveScope.class, "descriptiveScopeName")).thenReturn(data);
+ controller.getDescriptiveDictionaryByNameEntityData(response);
+ try {
+ assertTrue(response.getContentAsString() != null
+ && response.getContentAsString().contains("descriptiveScopeDictionaryDatas"));
+ } catch (Exception e) {
+ fail();
+ logger.error(e.getMessage(), e);
+ }
+ }
+
+ @Test
+ public void testGetDescriptiveDictionaryEntityData() {
+ when(commonClassDao.getData(DescriptiveScope.class)).thenReturn(testDescriptiveScope());
+ controller.getDescriptiveDictionaryEntityData(response);
+ try {
+ assertTrue(response.getContentAsString() != null
+ && response.getContentAsString().contains("descriptiveScopeDictionaryDatas"));
+ } catch (Exception e) {
+ fail();
+ logger.error(e.getMessage(), e);
+ }
+ }
+
+ @Test
+ public void testSaveDescriptiveDictionary() {
+ jsonString =
+ "{\"descriptiveScopeDictionaryData\":{\"attributes\":[{\"$$hashKey\":\"object:257\",\"id\":"
+ + "\"choice1\",\"number\":\"12\",\"option\":\"test\"}],\"description\":\"test\","
+ + "\"descriptiveScopeName\":\"Test\",\"search\":\"Test\"},\"userid\":\"demo\"}";
+ try (BufferedReader br = new BufferedReader(new StringReader(jsonString))) {
+ when(request.getReader()).thenReturn(br);
+ controller.saveDescriptiveDictionary(request, response);
+ assertTrue(response.getContentAsString() != null
+ && response.getContentAsString().contains("descriptiveScopeDictionaryDatas"));
+ } catch (Exception e) {
+ logger.error("Exception" + e);
+ }
+ }
+
+ @Test
+ public void testUpdateDescriptiveDictionary() {
+ jsonString =
+ "{\"descriptiveScopeDictionaryData\":{\"attributes\":[{\"$$hashKey\":\"object:257\",\"id\":"
+ + "\"choice1\",\"number\":\"12\",\"option\":\"test\"}],\"description\":\"test\","
+ + "\"descriptiveScopeName\":\"Test\",\"id\":1,\"search\":\"Test\"},\"userid\":\"demo\"}";
+ try (BufferedReader br = new BufferedReader(new StringReader(jsonString))) {
+ when(request.getReader()).thenReturn(br);
+ controller.saveDescriptiveDictionary(request, response);
+ assertTrue(response.getContentAsString() != null
+ && response.getContentAsString().contains("descriptiveScopeDictionaryDatas"));
+ } catch (Exception e) {
+ logger.error("Exception" + e);
+ }
+ }
+
+ @Test
+ public void testRemoveDescriptiveDictionary() {
+ jsonString =
+ "{\"data\":{\"attributes\":[{\"$$hashKey\":\"object:257\",\"id\":\"choice1\",\"number\":\"12\","
+ + "\"option\":\"test\"}],\"description\":\"test\",\"descriptiveScopeName\":\"Test\",\"id\":1,"
+ + "\"search\":\"Test\"},\"userid\":\"demo\"}";
+ try (BufferedReader br = new BufferedReader(new StringReader(jsonString))) {
+ when(request.getReader()).thenReturn(br);
+ controller.removeDescriptiveDictionary(request, response);
+ assertTrue(response.getContentAsString() != null
+ && response.getContentAsString().contains("descriptiveScopeDictionaryDatas"));
+ } catch (Exception e) {
+ logger.error("Exception" + e);
+ }
+ }
+}