@Test
public void addApplicationThrowsExceptionWhenNotBelongingToUser() {

    // given
    User user = new User("user");
    User wrongUser = new User("other-user");
    given(applicationMock.getUser()).willReturn(wrongUser);
    // when
    assertThatThrownBy(() -> user.addApplication(applicationMock))
            .isInstanceOf(IllegalArgumentException.class)
            .hasMessage("The application belongs to another user!");
}