Exemplo n.º 1
0
  @Test
  public void testCreateMods() {
    ModsDefinition mods = new ModsDefinition();
    NdkPeriodicalMapper mapper = new NdkPeriodicalMapper();
    Context ctx = EasyMock.createMock(Context.class);
    EasyMock.expect(ctx.getPid()).andReturn("uuid:testId").anyTimes();
    EasyMock.replay(ctx);

    mapper.createMods(mods, ctx);
    List<IdentifierDefinition> identifiersResult = mods.getIdentifier();
    assertEquals(1, identifiersResult.size());
    IdentifierDefinition idResult = identifiersResult.get(0);
    assertEquals("uuid", idResult.getType());
    assertEquals("testId", idResult.getValue());

    assertEquals(1, mods.getTypeOfResource().size());
    assertEquals("text", mods.getTypeOfResource().get(0).getValue());

    assertEquals(1, mods.getGenre().size());
    assertEquals("title", mods.getGenre().get(0).getValue());

    assertEquals(1, mods.getOriginInfo().size());
    assertEquals(1, mods.getOriginInfo().get(0).getIssuance().size());
    assertEquals(IssuanceDefinition.CONTINUING, mods.getOriginInfo().get(0).getIssuance().get(0));
    assertEquals(0, mods.getOriginInfo().get(0).getPlace().size());
  }
Exemplo n.º 2
0
  @Test
  public void testCreateMods_FixIssuance() {
    ModsDefinition mods = new ModsDefinition();
    NdkPeriodicalMapper mapper = new NdkPeriodicalMapper();
    Context ctx = EasyMock.createMock(Context.class);
    EasyMock.expect(ctx.getPid()).andReturn("uuid:testId").anyTimes();
    EasyMock.replay(ctx);

    OriginInfoDefinition oi = new OriginInfoDefinition();
    oi.getIssuance().add(IssuanceDefinition.SERIAL);
    mods.getOriginInfo().add(oi);

    mapper.createMods(mods, ctx);

    assertEquals(
        Arrays.asList(IssuanceDefinition.CONTINUING), mods.getOriginInfo().get(0).getIssuance());
  }