### Question:
PropertyValueUtils { @NonNull public static List<String> getList(@NonNull final PropertyDescriptor propertyDescriptor, @NonNull final PropertyContext context, @Nullable final FlowFile flowFile) { Objects.requireNonNull(propertyDescriptor, "PropertyDescriptor is required"); Objects.requireNonNull(context, "PropertyContext is required"); List<String> results = new ArrayList<>(); PropertyValue property = context.getProperty(propertyDescriptor); if (property == null) { return results; } String value = property.evaluateAttributeExpressions(flowFile).getValue(); if (value == null || value.trim().isEmpty()) { return results; } for (final String item : value.split(",")) { if (item != null && !item.trim().isEmpty()) { results.add(item.trim()); } } return results; } private  PropertyValueUtils(); @NonNull static E getEnumValue(@NonNull final PropertyDescriptor propertyDescriptor,
                                                  @NonNull final PropertyContext context,
                                                  @NonNull final Class<E> enumType,
                                                  @NonNull final E defaultValue); @Nullable static E getEnumValue(@NonNull final Class<E> enumType,
                                                   @Nullable final E defaultValue,
                                                   @Nullable final String propertyValue); @NonNull static List<String> getList(@NonNull final PropertyDescriptor propertyDescriptor,
                                       @NonNull final PropertyContext context,
                                       @Nullable final FlowFile flowFile); @NonNull static MapperOptions getMapperOptions(@NonNull final PropertyContext context,
                                                 @Nullable final FlowFile flowFile);  }### Answer:
@Test public void listValue() { testRunner.setProperty(TEST_LIST_PROPERTY, "one,two"); List<String> list = PropertyValueUtils.getList(TEST_LIST_PROPERTY, processContext, null); Assert.assertEquals(2, list.size()); Assert.assertEquals("one", list.get(0)); Assert.assertEquals("two", list.get(1)); }
@Test public void listValueEmpty() { testRunner.setProperty(TEST_LIST_PROPERTY, ""); List<String> list = PropertyValueUtils.getList(TEST_LIST_PROPERTY, processContext, null); Assert.assertEquals(0, list.size()); testRunner.setProperty(TEST_LIST_PROPERTY, " "); list = PropertyValueUtils.getList(TEST_LIST_PROPERTY, processContext, null); Assert.assertEquals(0, list.size()); }
@Test public void listValueTrim() { testRunner.setProperty(TEST_LIST_PROPERTY, "one, two,"); List<String> list = PropertyValueUtils.getList(TEST_LIST_PROPERTY, processContext, null); Assert.assertEquals(2, list.size()); Assert.assertEquals("one", list.get(0)); Assert.assertEquals("two", list.get(1)); }
@Test public void listValueSkipEmpty() { testRunner.setProperty(TEST_LIST_PROPERTY, "one,, ,two"); List<String> list = PropertyValueUtils.getList(TEST_LIST_PROPERTY, processContext, null); Assert.assertEquals(2, list.size()); Assert.assertEquals("one", list.get(0)); Assert.assertEquals("two", list.get(1)); }
@Test public void listValueOverExpression() { ProcessSession processSession = testRunner.getProcessSessionFactory().createSession(); FlowFile flowFile = processSession.create(); Map<String, String> props = new HashMap<>(); props.put("listValue", "three,two,one"); flowFile = processSession.putAllAttributes(flowFile, props); testRunner.setProperty(TEST_LIST_PROPERTY, "${listValue}"); List<String> list = PropertyValueUtils.getList(TEST_LIST_PROPERTY, processContext, flowFile); Assert.assertEquals(3, list.size()); Assert.assertEquals("three", list.get(0)); Assert.assertEquals("two", list.get(1)); Assert.assertEquals("one", list.get(2)); }