ArrayAccessor extends ArrayPropertyAccessor { @Override public Object getProperty(Map context, Object target, Object object) throws OgnlException { try { return super.getProperty(context, target, object); } catch (IndexOutOfBoundsException ex) { return null; } }  @Override Object getProperty(Map context, Object target, Object object); @Override void setProperty(Map context, Object array, Object key, Object value);  }
@Test public void gettingShouldReturnNullIfIndexNotFound() throws Exception { Long[] l = new Long[] {}; Object value = accessor.getProperty(null, l, 1); assertThat(value, is(nullValue())); }
@Test public void gettingShouldReturnValueIfIndexFound() throws Exception { Long[] l = new Long[] { 15L, 22L }; Object value = accessor.getProperty(null, l, 1); assertThat(value, is(equalTo((Object) 22L))); }