// Path: src/main/java/com/github/mk23/jmxproxy/jmx/ConnectionCredentials.java
// public class ConnectionCredentials {
//     @NotEmpty
//     @JsonProperty
//     private final String username;
// 
//     @NotEmpty
//     @JsonProperty
//     private final String password;
// 
//     private final String combined;
// 
//     private final boolean enabled;
// 
//     /**
//      * <p>Default disabled constructor.</p>
//      *
//      * Creates a disabled credential object used for anonymous agent access.
//      */
//     public ConnectionCredentials() {
//         username = null;
//         password = null;
//         combined = null;
// 
//         enabled = false;
//     }
// 
//     /**
//      * <p>Default constructor.</p>
//      *
//      * Sets the instance username and password {@link String}s from provided parameters.
//      * Builds a single combined credential string for the hashCode computation.
//      *
//      * @param username username {@link String} for the new credential instance.
//      * @param password password {@link String} for the new credential instance.
//      */
//     public ConnectionCredentials(
//         @JsonProperty("username") final String username,
//         @JsonProperty("password") final String password
//     ) {
//         if (username == null || password == null) {
//             this.username = null;
//             this.password = null;
//             this.combined = null;
// 
//             this.enabled = false;
//         } else {
//             this.username = username;
//             this.password = password;
//             this.combined = username + "\0" + password;
// 
//             this.enabled = true;
//         }
//     }
// 
//     /**
//      * <p>Getter for username.</p>
//      *
//      * Fetches the stored username {@link String}.
//      *
//      * @return username string.
//      */
//     public final String getUsername() {
//         return username;
//     }
// 
//     /**
//      * <p>Getter for password.</p>
//      *
//      * Fetches the stored password {@link String}.
//      *
//      * @return password string.
//      */
//     public final String getPassword() {
//         return password;
//     }
// 
//     /**
//      * <p>Getter for enabled.</p>
//      *
//      * Fetches enabled status for this credential object.
//      *
//      * @return enabled boolean.
//      */
//     public final boolean isEnabled() {
//         return enabled;
//     }
// 
//     /** {@inheritDoc} */
//     @Override
//     public final boolean equals(final Object obj) {
//         if (obj != null && !(obj instanceof ConnectionCredentials)) {
//             return false;
//         }
// 
//         ConnectionCredentials peer = (obj != null) ? (ConnectionCredentials) obj : new ConnectionCredentials();
// 
//         if (!enabled) {
//             return !peer.isEnabled();
//         }
// 
//         return username.equals(peer.getUsername()) && password.equals(peer.getPassword());
//     }
// 
//     /** {@inheritDoc} */
//     @Override
//     public final int hashCode() {
//         return combined != null ? combined.hashCode() : 0;
//     }
// }


import com.github.mk23.jmxproxy.jmx.ConnectionCredentials;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertFalse;
        final ConnectionCredentials auth = new ConnectionCredentials(new String("user"), new String("pass"));

        assertFalse(auth.equals(new String("")));
    }

    @Test
    public void checkAuthenticatedEnabled() throws Exception {
        final ConnectionCredentials auth = new ConnectionCredentials(new String("user"), new String("pass"));

        assertTrue(auth.isEnabled());
    }

    @Test
    public void checkAuthenticatedHashCode() throws Exception {
        final ConnectionCredentials auth = new ConnectionCredentials(new String("user"), new String("pass"));

        assertTrue(auth.hashCode() == new String("user\0pass").hashCode());
    }

    @Test
    public void checkAnonymousEquals() throws Exception {
        final ConnectionCredentials auth1 = new ConnectionCredentials();
        final ConnectionCredentials auth2 = new ConnectionCredentials();

        assertTrue(auth1.equals(auth2));
    }

    @Test
    public void checkAnonymousNotEquals() throws Exception {
        final ConnectionCredentials auth1 = new ConnectionCredentials();
// Path: src/main/java/com/github/mk23/jmxproxy/jmx/ConnectionCredentials.java
// public class ConnectionCredentials {
//     @NotEmpty
//     @JsonProperty
//     private final String username;
// 
//     @NotEmpty
//     @JsonProperty
//     private final String password;
// 
//     private final String combined;
// 
//     private final boolean enabled;
// 
//     /**
//      * <p>Default disabled constructor.</p>
//      *
//      * Creates a disabled credential object used for anonymous agent access.
//      */
//     public ConnectionCredentials() {
//         username = null;
//         password = null;
//         combined = null;
// 
//         enabled = false;
//     }
// 
//     /**
//      * <p>Default constructor.</p>
//      *
//      * Sets the instance username and password {@link String}s from provided parameters.
//      * Builds a single combined credential string for the hashCode computation.
//      *
//      * @param username username {@link String} for the new credential instance.
//      * @param password password {@link String} for the new credential instance.
//      */
//     public ConnectionCredentials(
//         @JsonProperty("username") final String username,
//         @JsonProperty("password") final String password
//     ) {
//         if (username == null || password == null) {
//             this.username = null;
//             this.password = null;
//             this.combined = null;
// 
//             this.enabled = false;
//         } else {
//             this.username = username;
//             this.password = password;
//             this.combined = username + "\0" + password;
// 
//             this.enabled = true;
//         }
//     }
// 
//     /**
//      * <p>Getter for username.</p>
//      *
//      * Fetches the stored username {@link String}.
//      *
//      * @return username string.
//      */
//     public final String getUsername() {
//         return username;
//     }
// 
//     /**
//      * <p>Getter for password.</p>
//      *
//      * Fetches the stored password {@link String}.
//      *
//      * @return password string.
//      */
//     public final String getPassword() {
//         return password;
//     }
// 
//     /**
//      * <p>Getter for enabled.</p>
//      *
//      * Fetches enabled status for this credential object.
//      *
//      * @return enabled boolean.
//      */
//     public final boolean isEnabled() {
//         return enabled;
//     }
// 
//     /** {@inheritDoc} */
//     @Override
//     public final boolean equals(final Object obj) {
//         if (obj != null && !(obj instanceof ConnectionCredentials)) {
//             return false;
//         }
// 
//         ConnectionCredentials peer = (obj != null) ? (ConnectionCredentials) obj : new ConnectionCredentials();
// 
//         if (!enabled) {
//             return !peer.isEnabled();
//         }
// 
//         return username.equals(peer.getUsername()) && password.equals(peer.getPassword());
//     }
// 
//     /** {@inheritDoc} */
//     @Override
//     public final int hashCode() {
//         return combined != null ? combined.hashCode() : 0;
//     }
// }


// Path: src/test/java/com/github/mk23/jmxproxy/jmx/tests/ConnectionCredentialsTest.java
import com.github.mk23.jmxproxy.jmx.ConnectionCredentials;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertFalse;

        final ConnectionCredentials auth = new ConnectionCredentials(new String("user"), new String("pass"));

        assertFalse(auth.equals(new String("")));
    }

    @Test
    public void checkAuthenticatedEnabled() throws Exception {
        final ConnectionCredentials auth = new ConnectionCredentials(new String("user"), new String("pass"));

        assertTrue(auth.isEnabled());
    }

    @Test
    public void checkAuthenticatedHashCode() throws Exception {
        final ConnectionCredentials auth = new ConnectionCredentials(new String("user"), new String("pass"));

        assertTrue(auth.hashCode() == new String("user\0pass").hashCode());
    }

    @Test
    public void checkAnonymousEquals() throws Exception {
        final ConnectionCredentials auth1 = new ConnectionCredentials();
        final ConnectionCredentials auth2 = new ConnectionCredentials();

        assertTrue(auth1.equals(auth2));
    }

    @Test
    public void checkAnonymousNotEquals() throws Exception {
        final ConnectionCredentials auth1 = new ConnectionCredentials();
        final ConnectionCredentials auth2 = new ConnectionCredentials(new String("user"), new String("pass"));