Instantly share code, notes, and snippets.

Embed
What would you like to do?
Unit tests with dates 2
public void mutability() throws Exception {
User user = new User().setDateOfBirth(new Date(1990, 1, 1));
Date date = user.getDateOfBirth();
date.setYear(2014);
assertThat(user.getDateOfBirth(), is(new Date(2014, 1, 1)));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment