示例#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));
 }
示例#2
0
  public void testPlugin() throws Exception {
    Au au1 = new Au();
    au1.put(Au.PLUGIN, PLUGIN_VALUE);
    assertEquals(PLUGIN_VALUE, au1.getPlugin());
    assertNull(au1.getPluginPrefix());
    assertNull(au1.getPluginSuffix());
    assertEquals(PLUGIN_VALUE, au1.getComputedPlugin());

    Au au2 = new Au();
    au2.put(Au.PLUGIN_PREFIX, PLUGIN_PREFIX_VALUE);
    au2.put(Au.PLUGIN_SUFFIX, PLUGIN_SUFFIX_VALUE);
    assertNull(au2.getPlugin());
    assertEquals(PLUGIN_PREFIX_VALUE, au2.getPluginPrefix());
    assertEquals(PLUGIN_SUFFIX_VALUE, au2.getPluginSuffix());
    assertEquals(PLUGIN_PREFIX_VALUE + PLUGIN_SUFFIX_VALUE, au2.getComputedPlugin());

    // Other combinations are illegal but have the following behavior:

    Au au3 = new Au();
    au3.put(Au.PLUGIN, PLUGIN_VALUE);
    au3.put(Au.PLUGIN_PREFIX, PLUGIN_PREFIX_VALUE);
    assertEquals(PLUGIN_VALUE, au3.getPlugin());
    assertEquals(PLUGIN_PREFIX_VALUE, au3.getPluginPrefix());
    assertNull(au3.getPluginSuffix());
    assertEquals(PLUGIN_VALUE, au3.getComputedPlugin());

    Au au4 = new Au();
    au4.put(Au.PLUGIN, PLUGIN_VALUE);
    au4.put(Au.PLUGIN_SUFFIX, PLUGIN_SUFFIX_VALUE);
    assertEquals(PLUGIN_VALUE, au4.getPlugin());
    assertNull(au4.getPluginPrefix());
    assertEquals(PLUGIN_SUFFIX_VALUE, au4.getPluginSuffix());
    assertEquals(PLUGIN_VALUE, au4.getComputedPlugin());

    Au au5 = new Au();
    au5.put(Au.PLUGIN_PREFIX, PLUGIN_PREFIX_VALUE);
    assertNull(au5.getPlugin());
    assertEquals(PLUGIN_PREFIX_VALUE, au5.getPluginPrefix());
    assertNull(au5.getPluginSuffix());
    assertNull(au5.getComputedPlugin());

    Au au6 = new Au();
    au6.put(Au.PLUGIN_SUFFIX, PLUGIN_SUFFIX_VALUE);
    assertNull(au6.getPlugin());
    assertNull(au6.getPluginPrefix());
    assertEquals(PLUGIN_SUFFIX_VALUE, au6.getPluginSuffix());
    assertNull(au6.getComputedPlugin());
  }