package org.gbif.api.model.occurrence;

import org.gbif.dwc.terms.DwcTerm;

import org.junit.Test;

import static org.junit.Assert.assertEquals;

public class VerbatimOccurrenceTest {

  @Test
  public void testFieldUpdate() {
    VerbatimOccurrence occ = new VerbatimOccurrence();
    String catNum = "abc123";
    occ.setField(DwcTerm.catalogNumber, catNum);
    assertEquals(catNum, occ.getField(DwcTerm.catalogNumber));

    String catNum2 = "qwer";
    occ.setField(DwcTerm.catalogNumber, catNum2);
    assertEquals(catNum2, occ.getField(DwcTerm.catalogNumber));
  }
}

@@ -69,16 +69,91 @@
 cTerm;%0A%0A
+import java.io.IOException;%0A%0Aimport org.codehaus.jackson.map.ObjectMapper;%0A
 import o
@@ -639,11 +639,609 @@
 r));%0A  %7D
+%0A%0A  @Test%0A  public void testJsonSerde() throws IOException %7B%0A    ObjectMapper mapper = new ObjectMapper();%0A%0A    VerbatimOccurrence verb = new VerbatimOccurrence();%0A    verb.setField(DwcTerm.institutionCode, %22IC%22);%0A    verb.setField(DwcTerm.collectionCode, %22BUGS%22);%0A    verb.setField(DwcTerm.catalogNumber, %22MD10782%22);%0A%0A    String json = mapper.writeValueAsString(verb);%0A    VerbatimOccurrence deser = mapper.readValue(json, VerbatimOccurrence.class);%0A    assertEquals(verb, deser);%0A    for (DwcTerm term : DwcTerm.values()) %7B%0A      assertEquals(verb.getField(term), deser.getField(term));%0A    %7D%0A  %7D
 %0A%7D%0A

add json serde test to verbatim occurrence