### Question:
PropertyHelper { public List<PropertyEntry<?>> getObjectProperties(ObjectRecord objectRecord, TraverseParams traverseParams) { if (objectRecord == null) throw new IllegalArgumentException("Missing required argument objectRecord!"); if (traverseParams == null) throw new IllegalArgumentException("Missing required argument traverseParams!"); List<PropertyEntry<?>> props = getOneLeggedFactsAsProperties(objectRecord, traverseParams); props.add(new PropertyEntry<>("value", objectRecord.getValue())); return props; } @Inject  PropertyHelper(FactRetractionHandler factRetractionHandler,
                        ObjectFactDao objectFactDao,
                        ObjectFactTypeResolver objectFactTypeResolver,
                        TiSecurityContext securityContext,
                        SubjectResolver subjectResolver,
                        OrganizationResolver organizationResolver,
                        OriginResolver originResolver); List<PropertyEntry<?>> getObjectProperties(ObjectRecord objectRecord, TraverseParams traverseParams); List<PropertyEntry<?>> getFactProperties(FactRecord factRecord, TraverseParams traverseParams);  }### Answer:
@Test public void testGetObjectPropsInputValidation() { assertThrows(IllegalArgumentException.class, () -> helper.getObjectProperties(null, TraverseParams.builder().build())); assertThrows(IllegalArgumentException.class, () -> helper.getObjectProperties(new ObjectRecord(), null)); }
@Test public void testGetObjectProps() { ObjectRecord objectRecord = new ObjectRecord().setId(UUID.randomUUID()).setValue("someValue"); when(objectFactDao.searchFacts(any())).thenAnswer(x -> ResultContainer.<FactRecord>builder().build()); List<PropertyEntry<?>> props = helper.getObjectProperties(objectRecord, TraverseParams.builder().build()); assertEquals(1, props.size()); assertEquals("value", props.get(0).getName()); assertEquals("someValue", props.get(0).getValue()); verify(objectFactDao).searchFacts(argThat(c -> { assertEquals(set(objectRecord.getId()), c.getObjectID()); return true; })); }
@Test public void testGetObjectPropsWithNameValue() { UUID objectId = UUID.randomUUID(); ObjectRecord objectRecord = new ObjectRecord().setId(objectId).setValue("objectValue"); FactTypeStruct factType1 = mockFactType("value"); FactRecord fact = new FactRecord().setTypeID(factType1.getId()).setValue("someFactValue"); when(securityContext.hasReadPermission(any(FactRecord.class))).thenReturn(true); when(objectFactDao.searchFacts(argThat(x -> Objects.equals(x.getObjectID(), set(objectId))))).thenReturn( ResultContainer.<FactRecord>builder().setValues(ListUtils.list(fact).iterator()).build() ); List<PropertyEntry<?>> props = helper.getObjectProperties( objectRecord, TraverseParams.builder().setIncludeRetracted(true).build()); assertEquals(2, props.size()); assertEquals(set("value->objectValue", "value->someFactValue"), asKeyValueStrings(props)); }