Package ru.org.linux.tag

Examples of ru.org.linux.tag.TagNotFoundException


  public void addMultiplyTagsTest() {
    UserTagService mockUserTagService = mock(UserTagService.class);
    when(mockUserTagService.addMultiplyTags(any(User.class), anyString(), anyBoolean())).thenCallRealMethod();
    when(mockUserTagService.parseTags(anyString(), any(Errors.class))).thenCallRealMethod();
    try{
      doThrow(new TagNotFoundException()).when(mockUserTagService).favoriteAdd(eq(user), eq("uytutut"));
      doThrow(new DuplicateKeyException("duplicate")).when(mockUserTagService).favoriteAdd(eq(user), eq("tag3"));
    } catch (Exception e) {}

    List<String> strErrors = mockUserTagService.addMultiplyTags(user, "tag1, tag2, tag3, uytutut, @#$%$#", true);
    try{
      verify(mockUserTagService).favoriteAdd(eq(user), eq("tag1"));
      verify(mockUserTagService).favoriteAdd(eq(user), eq("tag2"));
      verify(mockUserTagService).favoriteAdd(eq(user), eq("uytutut"));
      verify(mockUserTagService, never()).favoriteAdd(eq(user), eq("@#$%$#"));
      verify(mockUserTagService, never()).ignoreAdd(any(User.class), anyString());
    } catch (Exception e) {}
    Assert.assertEquals(3, strErrors.size());

    reset(mockUserTagService);
    when(mockUserTagService.addMultiplyTags(any(User.class), anyString(), anyBoolean())).thenCallRealMethod();
    when(mockUserTagService.parseTags(anyString(), any(Errors.class))).thenCallRealMethod();
    try{
      doThrow(new TagNotFoundException()).when(mockUserTagService).ignoreAdd(eq(user), eq("uytutut"));
      doThrow(new DuplicateKeyException("duplicate")).when(mockUserTagService).ignoreAdd(eq(user), eq("tag3"));
    } catch (Exception e) {}

    strErrors = mockUserTagService.addMultiplyTags(user, "tag1, tag2, tag3, uytutut, @#$%$#", false);
    try{
View Full Code Here

TOP

Related Classes of ru.org.linux.tag.TagNotFoundException

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.