@Test
public void testRequestScope() throws Exception {
MockApplication<?> app = application("plugin.controller.scope.request").init();
//
MockClient client = app.client();
//
MockRequestBridge request = client.render();
List<Scoped> attributes = request.getAttributesHistory();
assertEquals(1, attributes.size());
Identifiable car = (Identifiable)attributes.iterator().next().get();
assertEquals(Identifiable.DESTROYED, car.getStatus());
//
long id1 = Registry.<Long>unset("car");
assertEquals(car.getIdentityHashCode(), id1);
assertEquals(Identifiable.MANAGED, (int)Registry.<Integer>unset("status"));
//
request = client.invoke(Registry.<String>unset("action"));
attributes = request.getAttributesHistory();
assertEquals(1, attributes.size());
car = (Identifiable)attributes.iterator().next().get();
assertEquals(Identifiable.DESTROYED, car.getStatus());
//
long id2 = Registry.<Long>unset("car");
assertNotSame(id1, id2);
assertEquals(id2, id2);
assertEquals(Identifiable.MANAGED, (int)Registry.<Integer>unset("status"));
//
request = client.invoke(Registry.<String>unset("resource"));
attributes = request.getAttributesHistory();
assertEquals(1, attributes.size());
car = (Identifiable)attributes.iterator().next().get();
assertEquals(Identifiable.DESTROYED, car.getStatus());