Question: I'm working on a simple sign up form. So far I have the form validation working but I am not sure how to get the alerts working as well. The idea is to have the user fill out their info, click submit, and an alert with their given information will pop up. How can I add an alert to make this work?

HTML:

```
<div class="sign-up">
                <form>
                    <h2>Sign Up</h2>
                    <label>Name:</label>
                    <input type="text" placeholder="Enter your name" value="" id="suName" required>
                    <label>Email:</label>
                    <input type="email" name="email" id="suEmail" required placeholder="Enter a valid email address">
                    <label>Password:</label>
                    <input type="password" placeholder="Enter your password" name="password" id="suPassword" required>
                    <input class="submit-button su-submit" type="submit" id="mySUButton">
                </form>
            </div>

```

JS:

```
function setBindings() {

    $(".sign-up form #mySIButton").click(function (e) {
        e.preventDefault();

        var suName = $(".sign-up form #suName").val(),
            email = $(".sign-up form #suEmail").val(),
            pw = $(".sign-up form #suPassword").val(),

            alert("This is your entered information: " + suName.value + ", " + email.value + ", " + pw + ".");
    });
}

$(document).ready(function () {
    setBindings();
});

```

Answer: 
Simply spoken: you can't.

The ability to **mock** calls to **new** requires to turn to the PowerMock(ito) or JMockit frameworks.

The real answer is: rework your production code to **not** make a call to `new` here, for example by:

* using [*dependency injection*](https://en.wikipedia.org/wiki/Dependency_injection) to provide an instance of that other class in your class under test
* using *dependency injection* to provide a **factory** that provides instances of the class you need (and then your **factory** is a mocked thing, that returns whatever you want it to return).

Long story short: before engaging in PowerMock or other frameworks, engage in learning how to create testable code. Watch these [videos](https://www.youtube.com/playlist?list=PLD0011D00849E1B79) for example.
Inherit from ValidationHandlerProcessor and create a new class ValidationHandlerProcessorMock and now in this mock the validate method or whichever method you want to mock.

```
public class ValidationHandlerProcessorMock extends ValidationHandlerProcessor{

    public void validate(args){
       // write mock code here
    }

}

```

Now in test file use

```
ValidationHandlerProcessor validationHandlerProcessor = new ValidationHandlerProcessorMock();

```