@Test public void testAddExistingFieldInputAlreadyExistingFieldExpectsOnlyOneFieldFromGetFields() { final String value = "Hello"; final MetadataField newFirst = createField("first", 0, value); final DublinCoreMetadataCollection collection = new DublinCoreMetadataCollection(Arrays .asList(unorderedOne, unorderedTwo, unorderedThree, first, third, seventh, newFirst)); int numberOfFirsts = 0; Opt<String> valueFound = Opt.none(); for (final MetadataField field : collection.getFields()) { if (field.getInputID().equals(FIRST_ID)) { numberOfFirsts++; if (field.getValue() != null && field.getValue() instanceof String) { valueFound = Opt.some((String) field.getValue()); } } } assertEquals("There should only be one field called first in the collection.", 1, numberOfFirsts); assertTrue("The value has been set so it should be in the collection.", valueFound.isSome()); assertEquals("There should only be one field called first in the collection.", value, valueFound.get()); }
public List<MetadataField> getFields() { return this.fieldsInOrder; }
DublinCoreMetadataCollection { public List<MetadataField> getFields() { return this.fieldsInOrder; } }
DublinCoreMetadataCollection { public List<MetadataField> getFields() { return this.fieldsInOrder; } DublinCoreMetadataCollection();  DublinCoreMetadataCollection(final Iterable<MetadataField> fields);  DublinCoreMetadataCollection(final DublinCoreMetadataCollection c); }
DublinCoreMetadataCollection { public List<MetadataField> getFields() { return this.fieldsInOrder; } DublinCoreMetadataCollection();  DublinCoreMetadataCollection(final Iterable<MetadataField> fields);  DublinCoreMetadataCollection(final DublinCoreMetadataCollection c); DublinCoreMetadataCollection readOnlyCopy(); Map<String, MetadataField> getOutputFields(); void addField(final MetadataField metadata); void addEmptyField(final MetadataField metadataField, final ListProvidersService listProvidersService); void addField(final MetadataField metadataField, final String value, final ListProvidersService listProvidersService); void addField(final MetadataField metadataField, final List<String> values, final ListProvidersService listProvidersService); void removeField(final MetadataField metadata); List<MetadataField> getFields(); void updateStringField(final MetadataField current, final String value); boolean isUpdated(); }
DublinCoreMetadataCollection { public List<MetadataField> getFields() { return this.fieldsInOrder; } DublinCoreMetadataCollection();  DublinCoreMetadataCollection(final Iterable<MetadataField> fields);  DublinCoreMetadataCollection(final DublinCoreMetadataCollection c); DublinCoreMetadataCollection readOnlyCopy(); Map<String, MetadataField> getOutputFields(); void addField(final MetadataField metadata); void addEmptyField(final MetadataField metadataField, final ListProvidersService listProvidersService); void addField(final MetadataField metadataField, final String value, final ListProvidersService listProvidersService); void addField(final MetadataField metadataField, final List<String> values, final ListProvidersService listProvidersService); void removeField(final MetadataField metadata); List<MetadataField> getFields(); void updateStringField(final MetadataField current, final String value); boolean isUpdated();  }