Skip to content

Instantly share code, notes, and snippets.

@Dalamar42
Created July 27, 2016 13:14
Show Gist options
  • Save Dalamar42/6aec9b3b09fbc4a12b13f9fff84b5e79 to your computer and use it in GitHub Desktop.
Save Dalamar42/6aec9b3b09fbc4a12b13f9fff84b5e79 to your computer and use it in GitHub Desktop.
// This is the fake we create
Database fakeDatabase = new Database() {
Map<Long, ApplicationKey> applications = Maps.newHashMap(
APP_ID, new ApplicationKey(APP_ID, Status.REVOKED)
);
@Override
public ApplicationKey getApplicationKey(Long id) {
return applications.get(id);
}
}
// Class that we want to test and that uses fakeDatabase
ApplicationService service = new ApplicationService(fakeDatabase);
// Test ApplicationService behaviour
assertThat(service.isRevoked(APP_ID), is(true));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment