Package com.calclab.emite.xep.search

Examples of com.calclab.emite.xep.search.SearchResultItem


public class SearchResultItemTest {

  @Test
  public void shouldHaveFirstIfPresent() {
    final SearchResultItem result = SearchResultItem.parse(XMLBuilder.fromXML("<item jid='juliet@capulet.com'>" + "<first>Juliet</first></item>"));
    assertEquals("juliet@capulet.com", result.getJid().toString());
    assertNull(result.getEmail());
    assertEquals("Juliet", result.getFirst());
    assertNull(result.getLast());
    assertNull(result.getNick());
  }
View Full Code Here


    assertNull(result.getNick());
  }

  @Test
  public void shouldHaveJIDIfPresent() {
    final SearchResultItem result = SearchResultItem.parse(XMLBuilder.fromXML("<item jid='juliet@capulet.com'>" + "</item>"));
    assertEquals("juliet@capulet.com", result.getJid().toString());
    assertNull(result.getEmail());
    assertNull(result.getFirst());
    assertNull(result.getLast());
    assertNull(result.getNick());
  }
View Full Code Here

    assertNull(result.getNick());
  }

  @Test
  public void shouldHaveLastIfPresent() {
    final SearchResultItem result = SearchResultItem.parse(XMLBuilder.fromXML("<item jid='juliet@capulet.com'>" + "<last>Capulet</last></item>"));
    assertEquals("juliet@capulet.com", result.getJid().toString());
    assertNull(result.getEmail());
    assertNull(result.getFirst());
    assertEquals("Capulet", result.getLast());
    assertNull(result.getNick());
  }
View Full Code Here

    Mockito.verify(result, Mockito.never()).onFailure(Matchers.anyString());
    Mockito.verify(result).onSuccess(Matchers.argThat(new ArgumentMatcher<List<SearchResultItem>>() {
      @Override
      public boolean matches(final Object arg0) {
        final List<SearchResultItem> list = (List<SearchResultItem>) arg0;
        final SearchResultItem searchResultItem1 = list.get(0);
        final SearchResultItem searchResultItem2 = list.get(1);
        assertEquals(2, list.size());
        assertEquals("Juliet", searchResultItem1.getFirst());
        assertEquals("Capulet", searchResultItem1.getLast());
        assertEquals("JuliC", searchResultItem1.getNick());
        assertEquals("juliet@shakespeare.lit", searchResultItem1.getEmail());
        assertEquals("juliet@capulet.com", searchResultItem1.getJid().toString());
        assertEquals("tybalt@shakespeare.lit", searchResultItem2.getJid().toString());
        return true;
      }
    }));
  }
View Full Code Here

TOP

Related Classes of com.calclab.emite.xep.search.SearchResultItem

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.