If statement is not executing despite true condition/boolean

I'm creating a Sign-Up/Log-In App in Java and I'm using an if statement for logging in. Despite the if statement being true, it goes on to execute the else block. What am I doing wrong here? Any help would be appreciated.

I tried printing out both sides of the "==" argument to make sure they are equal and it turned out they are. I don't understand why it goes on to the else-block.

    btnLogIn = new JButton("Log In");
    btnLogIn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            String test = emailBox.getText();
            if (map.get(test) == passBox.getText()) {
                JOptionPane.showMessageDialog(null, "Log In Successful" , "SMAIL", JOptionPane.PLAIN_MESSAGE);
            }
            else {
                JOptionPane.showMessageDialog(null, "Incorrect email or password!" , "SMAIL", JOptionPane.PLAIN_MESSAGE);
            }
            System.out.println(map.get(test)+ " " +passBox.getText());
        }
    });

I expected the if statement to execute and that is because the two values (map.get(test) and passBox.getText()) are equal and that shows when I print the two values after the if-else block. However, it executed the else block.