Exemple #1
0
 public void testEmpty() throws Exception {
   Au au = new Au();
   assertNull(au.getTitle());
   assertNull(au.getName());
   assertNull(au.getAuid());
   assertNull(au.getAuidPlus());
   assertNull(au.getComputedPlugin());
   assertNull(au.getEdition());
   assertNull(au.getEisbn());
   assertNull(au.getIsbn());
   assertNull(au.getPlugin());
   assertNull(au.getPluginPrefix());
   assertNull(au.getPluginSuffix());
   assertNull(au.getProvider());
   assertNull(au.getProxy());
   assertNull(au.getRights());
   assertNull(au.getStatus());
   assertNull(au.getStatus1());
   assertNull(au.getStatus2());
   assertNull(au.getVolume());
   assertNull(au.getYear());
   assertEmpty(au.getParams());
   assertEmpty(au.getNondefParams());
   assertEmpty(au.getAttrs());
   assertNull(au.getImplicit());
   assertNull(au.getArbitraryValue(FOO_KEY));
 }
Exemple #2
0
 public void testAu() throws Exception {
   Publisher publisher = new Publisher();
   Title title = new Title(publisher);
   Au au = new Au(title);
   assertSame(title, au.getTitle());
   assertSame(publisher, au.getTitle().getPublisher());
   au.put(Au.NAME, NAME_VALUE);
   assertEquals(NAME_VALUE, au.getName());
   au.put(Au.EDITION, EDITION_VALUE);
   assertEquals(EDITION_VALUE, au.getEdition());
   au.put(Au.EISBN, EISBN_VALUE);
   assertEquals(EISBN_VALUE, au.getEisbn());
   au.put(Au.ISBN, ISBN_VALUE);
   assertEquals(ISBN_VALUE, au.getIsbn());
   au.put(Au.PROVIDER, PROVIDER_VALUE);
   assertEquals(PROVIDER_VALUE, au.getProvider());
   au.put(Au.PROXY, PROXY_VALUE);
   assertEquals(PROXY_VALUE, au.getProxy());
   au.put(Au.RIGHTS, RIGHTS_VALUE);
   assertEquals(RIGHTS_VALUE, au.getRights());
   au.put(Au.STATUS, STATUS_VALUE);
   assertEquals(STATUS_VALUE, au.getStatus());
   au.put(Au.STATUS1, STATUS1_VALUE);
   assertEquals(STATUS1_VALUE, au.getStatus1());
   au.put(Au.STATUS2, STATUS2_VALUE);
   assertEquals(STATUS2_VALUE, au.getStatus2());
   au.put(Au.VOLUME, VOLUME_VALUE);
   assertEquals(VOLUME_VALUE, au.getVolume());
   au.put(Au.YEAR, YEAR_VALUE);
   assertEquals(YEAR_VALUE, au.getYear());
   au.put(String.format("param[%s]", PARAM1_KEY), PARAM1_VALUE);
   assertEquals(PARAM1_VALUE, au.getParams().get(PARAM1_KEY));
   assertNull(au.getParams().get("X" + PARAM1_KEY));
   au.put(String.format("nondefparam[%s]", NONDEFPARAM1_KEY), NONDEFPARAM1_VALUE);
   assertEquals(NONDEFPARAM1_VALUE, au.getNondefParams().get(NONDEFPARAM1_KEY));
   assertNull(au.getNondefParams().get("X" + NONDEFPARAM1_KEY));
   au.put(String.format("attr[%s]", ATTR1_KEY), ATTR1_VALUE);
   assertEquals(ATTR1_VALUE, au.getAttrs().get(ATTR1_KEY));
   assertNull(au.getAttrs().get("X" + ATTR1_KEY));
   au.setImplicit(IMPLICIT_VALUE);
   assertIsomorphic(Arrays.asList("implicit1", "implicit2", "implicit3"), au.getImplicit());
   au.put(FOO_KEY, FOO_VALUE);
   assertEquals(FOO_VALUE, au.getArbitraryValue(FOO_KEY));
   assertNull(au.getArbitraryValue("X" + FOO_KEY));
 }
Exemple #3
0
 public void testNesting() throws Exception {
   Au au1 = new Au();
   au1.put(Au.EISBN, EISBN_VALUE);
   au1.put(String.format("param[%s]", PARAM1_KEY), PARAM1_VALUE);
   au1.put(FOO_KEY, FOO_VALUE);
   au1.setImplicit(IMPLICIT_VALUE);
   Au au2 = new Au(au1);
   au2.put(Au.ISBN, ISBN_VALUE);
   au2.put(String.format("nondefparam[%s]", NONDEFPARAM1_KEY), NONDEFPARAM1_VALUE);
   Au au3 = new Au(au2);
   au3.put(Au.PLUGIN, PLUGIN_VALUE);
   au3.put(String.format("attr[%s]", ATTR1_KEY), ATTR1_VALUE);
   assertEquals(EISBN_VALUE, au3.getEisbn());
   assertEquals(ISBN_VALUE, au3.getIsbn());
   assertEquals(PLUGIN_VALUE, au3.getPlugin());
   assertEquals(PLUGIN_VALUE, au3.getComputedPlugin());
   assertEquals(PARAM1_VALUE, au3.getParams().get(PARAM1_KEY));
   assertEquals(NONDEFPARAM1_VALUE, au3.getNondefParams().get(NONDEFPARAM1_KEY));
   assertEquals(ATTR1_VALUE, au3.getAttrs().get(ATTR1_KEY));
   assertIsomorphic(Arrays.asList("implicit1", "implicit2", "implicit3"), au3.getImplicit());
   assertEquals(FOO_VALUE, au3.getArbitraryValue(FOO_KEY));
   assertNull(au3.getArbitraryValue("X" + FOO_KEY));
 }