Code example for Account

Methods: toString

0
        new Account("name", "");
    } 
 
    @Test 
    public void shouldHaveToString() throws Exception { 
        Account account = new Account("name", "type");
        assertThat(account.toString()).isEqualTo("Account {name=name, type=type}");
    } 
 
    @Test 
    public void shouldProvideEqualAndHashCode() throws Exception { 
        assertThat(new Account("a", "b")).isEqualTo(new Account("a", "b"));
        assertThat(new Account("a", "b")).isNotEqualTo(new Account("c", "b"));
        assertThat(new Account("a", "b").hashCode()).isEqualTo(new Account("a", "b").hashCode());
        assertThat(new Account("a", "b").hashCode()).isNotEqualTo(new Account("c", "b").hashCode());
    } 
} 
Experience pair programming with AI  Get Codota for Java