UserMenu implements MenuFactory.CustomMenuBuilder,
                                 HasMenus { @PostConstruct protected void setup() { userMenuView.setUserName(formattedUsername()); }  @Override void addMenus(final Menus menus); IsWidget getView(); @Override void push(MenuFactory.CustomMenuBuilder element); @Override MenuItem build(); void clear();  }
@Test public void testUserNameWithId() { final String userName = "mock"; when(user.getIdentifier()).thenReturn(userName); userMenu.setup(); verify(userMenuView).setUserName(userName); }
@Test public void testUserNameUsingFirstAndLastName() { final String firstName = "Mock"; final String lastName = "Test"; when(user.getProperty(User.StandardUserProperties.FIRST_NAME)).thenReturn(firstName); when(user.getProperty(User.StandardUserProperties.LAST_NAME)).thenReturn(lastName); userMenu.setup(); verify(userMenuView).setUserName(firstName + " " + lastName); }
@Test public void testUserNameUsingFirstName() { final String firstName = "Mock"; when(user.getProperty(User.StandardUserProperties.FIRST_NAME)).thenReturn(firstName); userMenu.setup(); verify(userMenuView).setUserName(firstName); }
@Test public void testUserNameUsingLastName() { final String lastName = "Test"; when(user.getProperty(User.StandardUserProperties.LAST_NAME)).thenReturn(lastName); userMenu.setup(); verify(userMenuView).setUserName(lastName); }