@Test public void testWithMarkupsNullAdditionalMarkups() { Sequence withMarkups = sequence.withMarkups(null); assertNotNull(withMarkups.getMarkups()); assertEquals(1, withMarkups.getMarkups().size()); assertEquals(24, withMarkups.getMarkups().get(0).getStart()); }
@Test public void testWithMarkupsEmptyAdditionalMarkups() { List<Markup> empty = Collections.emptyList(); Sequence withMarkups = sequence.withMarkups(empty); assertNotNull(withMarkups.getMarkups()); assertEquals(1, withMarkups.getMarkups().size()); assertEquals(24, withMarkups.getMarkups().get(0).getStart()); }
@Test public void testWithMarkups() { Markup markup = new Markup(); markup.setStart(13); Sequence withMarkups = sequence.withMarkups(ImmutableList.of(markup)); assertNotNull(withMarkups.getMarkups()); assertEquals(2, withMarkups.getMarkups().size()); for (Markup m : withMarkups.getMarkups()) { assertTrue(m.getStart() == 13 || m.getStart() == 24); } }
@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 testWithMarkupsNullMarkups() { sequence.setMarkups(null); Sequence withMarkups = sequence.withMarkups(null); assertNull(withMarkups.getMarkups()); }
@Test public void testDeepCopyNullMarkups() { sequence.setMarkups(null); Sequence copy = sequence.deepCopy(); assertNull(copy.getMarkups()); }