### Question:
AttributeResolver extends ELResolver { @Override public Object getValue(ELContext context, Object base, Object property) { return getAttributed(base) .flatMap(attributed -> attributed.abacAttribute(String.valueOf(property))) .map(value -> { context.setPropertyResolved(true); return value; }) .orElse(null); }  @Override Class<?> getCommonPropertyType(ELContext context, Object base); @Override Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context, Object base); @Override Class<?> getType(ELContext context, Object base, Object property); @Override Object getValue(ELContext context, Object base, Object property); @Override boolean isReadOnly(ELContext context, Object base, Object property); @Override void setValue(ELContext context, Object base, Object property, Object value);  }### Answer:
@Test public void testResolveAttribute() { AttributeResolver ar = new AttributeResolver(); ELContext context = Mockito.mock(ELContext.class); Object name = ar.getValue(context, new MyResource(Map.of("name", "jarda")), "name"); assertThat(name, notNullValue()); assertThat(name, is("jarda")); }
@Test public void testNoInterface() { AttributeResolver ar = new AttributeResolver(); ELContext context = Mockito.mock(ELContext.class); Object name = ar.getValue(context, "just a string", "name"); assertThat(name, nullValue()); }
@Test public void testMissingAttribute() { AttributeResolver ar = new AttributeResolver(); ELContext context = Mockito.mock(ELContext.class); Object name = ar.getValue(context, new MyResource(Map.of("nickname", "jarda")), "name"); assertThat(name, nullValue()); }