AcmeJsonResource extends AcmeResource { protected void invalidate() { data = null; } protected  AcmeJsonResource(Login login, URL location); JSON getJSON(); void update();  }
@Test public void testInvalidate() { Login login = TestUtils.login(); AcmeJsonResource resource = new DummyJsonResource(login, LOCATION_URL); assertThat(resource.isValid(), is(false)); assertUpdateInvoked(resource, 0); resource.setJSON(JSON_DATA); assertThat(resource.isValid(), is(true)); assertUpdateInvoked(resource, 0); resource.invalidate(); assertThat(resource.isValid(), is(false)); assertUpdateInvoked(resource, 0); assertThat(resource.getJSON(), is(JSON_DATA)); assertThat(resource.isValid(), is(true)); assertUpdateInvoked(resource, 1); }