NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

/**
* The Class TestObjectFields. /
*/
@SuppressWarnings("unchecked")

@Nested

@DisplayName("Function getObjectFields()")

@TestInstance(TestInstance.Lifecycle.PER_CLASS)
class TestObjectFields {

/**
* The dc object fields. /
*/
private List<MapDatasetObjectField> dcObjectFields = new ArrayList<>();

private _Object object;

private _Object allObject;


private List<_Field> fields;

private List<_Field> fields1;

/**
* Setup. /
*/
@BeforeEach
void setup() {

MapDatasetObjectField mapDatasetObjectField = new MapDatasetObjectField();
mapDatasetObjectField.setObjectFieldId(1L);
mapDatasetObjectField.setPkId(1L);
mapDatasetObjectField.setIsActive(true);
DcObject dcObject = new DcObject();
dcObject.setName("Name");
dcObject.setSysName("Test");
DcObjectField dcObjectField = new DcObjectField();
dcObjectField.setPkDcObjectFieldId(1L);
dcObjectField.setDescription("TEXT");
dcObjectField.setName("TestName");
dcObjectField.setSysName("Name");
dcObjectField.setDcObject(dcObject);
mapDatasetObjectField.setDcObjectField(dcObjectField);
DcDataset dcDataSet = new DcDataset();
dcDataSet.setObjectId(1L);
mapDatasetObjectField.setDcDataset(dcDataSet);
mapDatasetObjectField.setIsActive(true);
DcFieldFormat dcFieldFormat = new DcFieldFormat();
dcFieldFormat.setName("TestName");
DcFieldType dcFieldType = new DcFieldType();
dcFieldType.setName("Test");
dcObjectField.setDcFieldFormat(dcFieldFormat);
dcObjectField.setDcFieldType(dcFieldType);
dcObjectFields.add(mapDatasetObjectField);

_FieldType fieldType = new _FieldType();
fieldType.setName("user");
_Field field = new _Field();
_Field field1 = new _Field();
field1.setId(6L);
field1.setName("user");
field1.setSimpleType(fieldType);
field1.setDescription("user");
field1.setSystemName("user");

field.setId(1L);
field.setName("user");
field.setSimpleType(fieldType);
field.setDescription("user");
field.setSystemName("user");
fields = new ArrayList<>();
fields.add(field);
fields1 = new ArrayList<>();
fields1.add(field1);
object = new _Object();
object.setId(3L);
object.setFields(fields);

allObject = new _Object();
allObject.setId(2L);
allObject.setFields(fields1);

}

/**
* Return pk id when arguments are correct.
*
* @throws Exception the exception /
*/
@Test
void return_pkId_when_arguments_are_correct() throws Exception {
when(datasetManager.getFieldsByDatasetId(anyLong())).thenReturn(dcObjectFields);
when(objectMetadataUtil.getObject(anyLong())).thenReturn(object);
when(objectMetadataUtil.getObjectByName(anyString())).thenReturn(allObject);
Assertions.assertEquals(1L,
((List<ObjectFieldDTO>) datasetServiceImpl.getObjectFields(1L).getEntity()).get(0).getFieldId());
}

/**
* Return empty DT O when manager returns empty list.
*
* @throws Exception the exception /
*/
@Test
void return_empty_DTO_when_manager_returns_empty_list() throws Exception {
when(datasetManager.getFieldsByDatasetId(anyLong())).thenReturn(new ArrayList<>());
when(objectMetadataUtil.getObject(anyLong())).thenReturn(object);
when(objectMetadataUtil.getObjectByName(anyString())).thenReturn(allObject);
g4Props.when(()->G4Properties.getProperty(anyString())).thenReturn("false");

Assertions
.assertTrue(((List<ObjectFieldDTO>) datasetServiceImpl.getObjectFields(1L).getEntity()).isEmpty());
g4Props.when(()->G4Properties.getProperty(anyString())).thenReturn("true");
}

/**
* Return true for get deleted when is active is false.
*
* @throws Exception the exception /
*/
@Test
void return_true_for_getDeleted_when_isActive_is_false() throws Exception {
dcObjectFields.get(0).setIsActive(false);
when(datasetManager.getFieldsByDatasetId(anyLong())).thenReturn(dcObjectFields);
when(objectMetadataUtil.getObject(anyLong())).thenReturn(object);
when(objectMetadataUtil.getObjectByName(anyString())).thenReturn(allObject);
Assertions.assertTrue(
((List<ObjectFieldDTO>) datasetServiceImpl.getObjectFields(1L).getEntity()).get(0).getDeleted());
}
}
     
 
what is notes.io
 

Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 14 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.