Skip to content

Instantly share code, notes, and snippets.

@chbatey
Created August 18, 2013 19:40
Show Gist options
  • Save chbatey/6263587 to your computer and use it in GitHub Desktop.
Save chbatey/6263587 to your computer and use it in GitHub Desktop.
@Test
void testServiceStoresAllTheValues() {
//given
def mockForDataStore = new MockFor(Datastore)
mockForDataStore.demand.open { true }
mockForDataStore.demand.storeField {
k, v ->
if (k == "someKey") assert(v == "someValue")
if (k == "anotherKey") assert(k == "anotherValue")
}
def mockDataStore = mockForDataStore.proxyInstance()
def service = new Service(mockDataStore)
//when
service.processEntry([someKey:"someValue",
anotherKey:"anotherValue"])
//then
mockForDataStore.verify mockDataStore
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment