Ejemplo n.º 1
0
 @Test
 public void testExtractRel() {
   assertEquals("", AtomUtil.extractRel(""));
   assertEquals("foo", AtomUtil.extractRel("foo"));
   assertEquals("bar", AtomUtil.extractRel("foo bar"));
   assertEquals("foo", AtomUtil.extractRel("foo "));
 }
Ejemplo n.º 2
0
 @Test
 public void testExtractDescription() {
   assertEquals("", AtomUtil.extractDescription(""));
   assertEquals("foo", AtomUtil.extractDescription("foo bar"));
   assertEquals("", AtomUtil.extractDescription("foo"));
   assertEquals("foo", AtomUtil.extractDescription(" foo bar "));
   assertEquals("foo", AtomUtil.extractDescription(" foo bar whatever"));
 }
Ejemplo n.º 3
0
  @Test
  public void testGetBaseUrlForInvalidValue() {
    Entry newEntry = new Abdera().newEntry();
    // illegal argument exception
    newEntry.setBaseUri(new IRI("foo"));
    try {
      AtomUtil.getBaseUrl(newEntry);
      fail("IllegalArgumentException should have thrown");
    } catch (Exception e) {
      assertTrue(e instanceof IllegalArgumentException);
    }

    // malformed url exception
    newEntry.setBaseUri(new IRI("foo://test:8080/bar"));
    try {
      AtomUtil.getBaseUrl(newEntry);
      fail("IllegalArgumentException should have thrown");
    } catch (Exception e) {
      assertTrue(e.getCause() instanceof MalformedURLException);
    }
  }
Ejemplo n.º 4
0
 @Test
 public void testGetBaseUrl() {
   Entry newEntry = new Abdera().newEntry();
   newEntry.setBaseUri(new IRI("http://myserver:8080/myservice/Test.svc"));
   assertEquals("http://myserver:8080/myservice/Test.svc", AtomUtil.getBaseUrl(newEntry));
 }