### Question:
ControllerUtils { public static String getDisplayName(User user) { String displayName = user.getDisplayName(); return (displayName == null || "".equals(displayName)) ? user.getUsername() : displayName; }  static boolean isMobileDevice(HttpServletRequest request); static String getDeviceAppropriateView(HttpServletRequest request, String defaultView, String mobileView); static void addNavItemsToModel(String view, Model model, String referringPageId, User user); static void addNavItemsToModel(String view, Model model, String referringPageId, User user, boolean addStore); static NavigationMenu getTopMenu(String view, String referringPageId, User user, boolean addStoreLink); static String getDisplayName(User user);  }### Answer:
@Test public void getDisplayName_withDisplayName(){ assertEquals(user.getDisplayName(), ControllerUtils.getDisplayName(user)); }
@Test public void getDisplayName_withoutDisplayName(){ user.setDisplayName(""); user.setUsername("username"); assertEquals(user.getUsername(), ControllerUtils.getDisplayName(user)); }
@Test public void getDisplayName_withNullDisplayName(){ user.setDisplayName(null); user.setUsername("username"); assertEquals(user.getUsername(), ControllerUtils.getDisplayName(user)); }