NdkPageMapper extends NdkMapper { public ModsDefinition createPage(String pid, String pageIndex, String pageNumber, String pageType) { Context ctx = new Context(pid); return createPage(pageIndex, pageNumber, pageType, ctx); }  static ResourceBundle getPageTypeLabels(Locale locale); static String getPageTypeLabel(String pageType, Locale locale); @Override void createMods(ModsDefinition mods, Context ctx); @Override Page toJsonObject(ModsDefinition mods, Context ctx); @Override ModsDefinition fromJsonObject(ObjectMapper jsMapper, String json, Context ctx); ModsDefinition createPage(String pid, String pageIndex, String pageNumber, String pageType); ModsDefinition createPage(String pageIndex, String pageNumber, String pageType, Context ctx); ModsDefinition toMods(Page page, Context ctx); ModsDefinition toMods(Page page, ModsDefinition mods); static final String PAGE_TYPE_NORMAL; static final String RESOURCE_TYPE_TEXT; }
@Test public void testCreatePage() throws Exception { NdkPageMapper mapper = new NdkPageMapper(); ModsDefinition mods = mapper.createPage("uuid:test", "1", "[1]", "normalPage"); assertNotNull(mods); Page result = mapper.toJsonObject(mods, new Context("dummy")); assertNotNull(result); assertEquals("1", result.getIndex()); assertEquals("[1]", result.getNumber()); assertEquals("normalPage", result.getType()); assertNull(result.getNote()); assertEquals(Arrays.asList(new IdentifierItem(null, "uuid", "test")), result.getIdentifiers()); }