@Override
    protected Object getTargetObject(boolean key) {
        Object targetObject;
        if (key) {
            // keyData is never null
            if (keyData.isPortable() || keyData.isJson() || keyData.isCompact()) {
                targetObject = keyData;
            } else {
                targetObject = getKey();
            }
        } else {
            if (valueObject == null) {
                targetObject = getTargetObjectFromData();
            } else {
                if (valueObject instanceof PortableGenericRecord
                        || valueObject instanceof CompactGenericRecord) {
                    // These two classes should be able to be handled by respective Getters
                    // see PortableGetter and CompactGetter
                    // We get into this branch when in memory format is Object and
                    // - the cluster does not have PortableFactory configuration for Portable
                    // - the cluster does not related classes for Compact
                    targetObject = getValue();
                } else if (valueObject instanceof Portable
                        || serializationService.isCompactSerializable(valueObject)) {
                    targetObject = getValueData();
                } else {
                    // Note that targetObject can be PortableGenericRecord
                    // and it will be handled with PortableGetter for query.
                    // We get PortableGenericRecord here when in-memory format is OBJECT and
                    // the cluster does not have PortableFactory configuration for the object's factory ID
                    targetObject = getValue();
                }
            }
        }
        return targetObject;
    }
@Test
    public void testGetTargetObject_givenInstanceIsNotInitialized_whenKeyFlagIsFalse_thenReturnNull() {
        QueryableEntry entry = createEntry();

        assertNull(entry.getTargetObject(false));
    }