@Test public void testAddReverse() throws DogException { AdderUsageObserver.setUsed(false); Target source = new Target(); source.setPets(Arrays.asList(3L)); Source target = SourceTargetMapper.INSTANCE.toSource(source); assertThat(target).isNotNull(); assertThat(target.getPets().size()).isEqualTo(1); assertThat(target.getPets().get(0)).isEqualTo("cat"); }
@Test public void testShouldUseDefaultStrategy() throws DogException { AdderUsageObserver.setUsed(false); Source source = new Source(); source.setPets(Arrays.asList("mouse")); Target target = SourceTargetMapperStrategyDefault.INSTANCE.shouldFallBackToAdder(source); assertThat(target).isNotNull(); assertThat(target.getPets().size()).isEqualTo(1); assertThat(target.getPets().get(0)).isEqualTo(2L); assertFalse(AdderUsageObserver.isUsed()); }
@IssueKey("241") @Test public void testAdd() throws DogException { AdderUsageObserver.setUsed(false); Source source = new Source(); source.setPets(Arrays.asList("mouse")); Target target = SourceTargetMapper.INSTANCE.toTarget(source); assertThat(target).isNotNull(); assertThat(target.getPets().size()).isEqualTo(1); assertThat(target.getPets().get(0)).isEqualTo(2L); assertTrue(AdderUsageObserver.isUsed()); }
@IssueKey("242") @Test public void testSingleElementSource() throws DogException { AdderUsageObserver.setUsed(false); SingleElementSource source = new SingleElementSource(); source.setPet("mouse"); Target target = SourceTargetMapper.INSTANCE.fromSingleElementSource(source); assertThat(target).isNotNull(); assertThat(target.getPets().size()).isEqualTo(1); assertThat(target.getPets().get(0)).isEqualTo(2L); assertTrue(AdderUsageObserver.isUsed()); }