Exemple #1
0
  @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");
  }
Exemple #2
0
  @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());
  }
Exemple #3
0
  @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());
  }
Exemple #4
0
  @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());
  }