public static User createNewTestUser(EntityManager em) {
    CreateNewUserConsole newUser = new CreateNewUserConsole(em);
    DateFormat format = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss");
    Date date = new Date();
    String userName = "******" + format.format(date);
    String first = "test";
    String last = "name";
    String password = "******";
    newUser.insertNewUser(first, last, userName, password);

    LoginScreen login = new LoginScreen(em);
    User result = login.getUser(userName);
    return result;
  }
  @Test
  public void validateIncorrectPassword() {
    CreateNewUserConsole newUser = new CreateNewUserConsole(em);
    DateFormat format = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss");
    Date date = new Date();
    String userName = "******" + format.format(date);
    String first = "test";
    String last = "name";
    String password = "******";
    newUser.insertNewUser(first, last, userName, password);

    LoginScreen login = new LoginScreen(em);
    String failureDetails = "IsCorrectPassword returns true when it should have returned false";
    User user = login.getUser(userName);
    Assert.assertFalse(failureDetails, login.isCorrectPassword(user, "nottherightpassword"));
  }
  @Test
  public void userExistsTest() {
    CreateNewUserConsole newUser = new CreateNewUserConsole(em);
    DateFormat format = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss");
    Date date = new Date();
    String userName = "******" + format.format(date);
    String first = "test";
    String last = "name";
    String password = "******";
    newUser.insertNewUser(first, last, userName, password);

    LoginScreen login = new LoginScreen(em);
    String failureDetails = "Newly inserted user was not returned";
    User result = login.getUser(userName);
    Assert.assertTrue(failureDetails, result != null);
  }