### Question:
DocumentImpl implements Document { @Override public String getFirstValue(String fieldName) { List<String> values = get(fieldName); return values == null || values.size() == 0 ? null : values.get(0); } DocumentImpl(byte[] rawData, String id, Plan plan, Operation operation, Scanner source); @Override Multiset<String> keys(); @Override boolean putAll(@Nullable java.lang.String key, Iterable<? extends String> values); @Override boolean put(@Nonnull java.lang.String key, @Nonnull java.lang.String value); @Override boolean putAll(Multimap<? extends String, ? extends String> multimap); @Override Set<String> keySet(); @Override boolean containsEntry(@Nullable java.lang.Object key, @Nullable java.lang.Object value); @Override boolean remove(@Nullable java.lang.Object key, @Nullable java.lang.Object value); @Override boolean containsValue(@Nullable java.lang.Object value); @Override Collection<Map.Entry<String, String>> entries(); @Override boolean isEmpty(); @Override void clear(); @Override Map<String, Collection<String>> asMap(); @Override List<String> replaceValues(@Nullable java.lang.String key, Iterable<? extends String> values); @Override Collection<String> values(); @Override boolean containsKey(@Nullable java.lang.Object key); @Override List<String> get(@Nullable java.lang.String key); @Override int size(); @Override List<String> removeAll(@Nullable java.lang.Object key); @Override byte[] getRawData(); @Override void setRawData(byte[] rawData); @Override Status getStatus(); @Override void setStatus(Status status, String statusMessage); @Override void setStatus(Status status); @Override String getStatusMessage(); @Override void setStatusMessage(String message); @Override Entry toEntry(Step next); @Override ArrayListMultimap<String, String> getDelegate(); @Override String getId(); @Override String getHash(); @Override String getIdField(); @Override Operation getOperation(); String getSourceScannerName(); @Override String getFirstValue(String fieldName); @Override String toString();  }### Answer:
@Test public void testGetFirstValue() { expect(scannerMock.getName()).andReturn("my_name").anyTimes(); expect(planMock.getDocIdField()).andReturn("id").anyTimes(); replay(); DocumentImpl document = new DocumentImpl(new byte[]{}, "foo", planMock, Document.Operation.NEW, scannerMock); document.put("string", "stringvalue"); DocumentImpl document2 = new DocumentImpl(new byte[]{}, "foo", planMock, Document.Operation.NEW, scannerMock); document2.put("string", "stringvalue"); assertEquals("stringvalue", document.getFirstValue("string")); assertNull(document.getFirstValue("unknown")); }