@Test public void testDeepCopy() { Sequence copy = sequence.deepCopy(); assertNotSame(sequence, copy); assertEquals(sequence.getLength(), copy.getLength()); assertEquals(sequence.getMarkups(), copy.getMarkups()); assertNotSame(sequence.getMarkups(), copy.getMarkups()); assertEquals(sequence.getMetadata(), copy.getMetadata()); assertNotSame(sequence.getMetadata(), copy.getMetadata()); assertEquals(sequence.getMotifs(), copy.getMotifs()); assertNotSame(sequence.getMotifs(), copy.getMotifs()); assertEquals(sequence.getOptions().getBaseUrl(), copy.getOptions().getBaseUrl()); assertNotSame(sequence.getOptions(), copy.getOptions()); assertEquals(sequence.getRegions(), copy.getRegions()); assertNotSame(sequence.getRegions(), copy.getRegions()); }
@Test public void testDeserializeFromJsonO14640() throws Exception { ObjectMapper objectMapper = new ObjectMapper(); objectMapper.configure(ACCEPT_SINGLE_VALUE_AS_ARRAY, true); TypeFactory typeFactory = objectMapper.getTypeFactory(); InputStream inputStream = getClass().getResourceAsStream("/O14640.json"); List<Sequence> sequences = objectMapper.readValue( inputStream, typeFactory.constructCollectionType(List.class, Sequence.class)); assertNotNull(sequences); assertEquals(1, sequences.size()); Sequence s = sequences.get(0); assertEquals(695, s.getLength()); assertEquals(5, s.getRegions().size()); assertEquals(0, s.getMarkups().size()); assertEquals(7, s.getMotifs().size()); assertEquals("uniprot", s.getMetadata().get("database")); }
@Test public void testDeepCopyNullMotifs() { sequence.setMotifs(null); Sequence copy = sequence.deepCopy(); assertNull(copy.getMotifs()); }