### Question:
KernelExtension extends Service { protected final S getState( KernelData kernel ) { return kernel.getState( this ); } KernelExtension( String key ); @Override final int hashCode(); @Override final boolean equals( Object obj ); final void loadAgent( String agentArgs );  }### Answer:
@Test public void shouldRetrieveSameLoadedStateObjectWhenRequested() throws Exception { EmbeddedGraphDatabase graphdb = graphdb( "graphdb", true, 0 ); try { DummyExtension.State state = new DummyExtension().getState( getExtensions( graphdb ) ); assertNotNull( state ); assertSame( DummyExtension.lastState, state ); } finally { graphdb.shutdown(); } }
@Test public void differentExtensionsCanHaveDifferentState() throws Exception { EmbeddedGraphDatabase graphdb = graphdb( "graphdb", true, 0 ); try { KernelData kernel = getExtensions( graphdb ); DummyExtension.State state = new DummyExtension().getState( kernel ), other = new OtherExtension().getState( kernel ); assertNotNull( state ); assertNotNull( other ); assertNotSame( state, other ); } finally { graphdb.shutdown(); } }