@Test public void getCurrentUser() throws RSSException { RSUser rSUser = new RSUser(); when(userDaoMock.getCurrentUser()).thenReturn(rSUser); RSUser returned = userManager.getCurrentUser(); assertEquals(rSUser, returned); }
@Test public void getCurrentUserNoneExisting() throws RSSException { when(userDaoMock.getCurrentUser()).thenReturn(null); try { userManager.getCurrentUser(); } catch (RSSException e) { assertEquals(UNICAExceptionType.NON_ALLOWED_OPERATION, e.getExceptionType()); assertEquals("Your user is not authorized to access the RSS", e.getMessage()); } }