Skip to content

Instantly share code, notes, and snippets.

@ericmaino
Created March 14, 2023 04:26
Show Gist options
  • Save ericmaino/b5735dda5859fe83f160e60a4a0c7b86 to your computer and use it in GitHub Desktop.
Save ericmaino/b5735dda5859fe83f160e60a4a0c7b86 to your computer and use it in GitHub Desktop.
Adatper Tests
public interface UserRepository {
UserId save(User u);
User getUserById(UserId id);
void deleteUser(User u);
}
public UserRepositoryTests {
UserRepository users;
UserOracle oracle;
public deleteUserTest() {
User user = oracle.getValidUser();
users.deleteUser(u);
assertThat(users.getUserById(user.id)).is().null()
}
public deleteUserTest() {
User newUser = oracle.newUser();
UserId newUserId = users.saveUser(newUser);
assertThat(users.getUserById(newUser)).is().null()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment