@Test public void testGetObjectInstance() throws Exception { Attributes expectedAttributes = new NameAwareAttributes(); expectedAttributes.put("someAttribute", "someValue"); DirContextAdapter adapter = (DirContextAdapter) tested.getObjectInstance(contextMock, DN, null, new Hashtable(), expectedAttributes); verify(contextMock).close(); assertThat(adapter.getDn()).isEqualTo(DN); assertThat(adapter.getAttributes()).isEqualTo(expectedAttributes); }
@Override public final Object getObjectInstance( Object obj, Name name, Context nameCtx, Hashtable<?, ?> environment, Attributes attrs) throws Exception { try { String nameInNamespace; if (nameCtx != null) { nameInNamespace = nameCtx.getNameInNamespace(); } else { nameInNamespace = ""; } return constructAdapterFromName(attrs, name, nameInNamespace); } finally { if (obj instanceof Context) { Context ctx = (Context) obj; try { ctx.close(); } catch (Exception e) { } } } }
DefaultDirObjectFactory implements DirObjectFactory { @Override public final Object getObjectInstance( Object obj, Name name, Context nameCtx, Hashtable<?, ?> environment, Attributes attrs) throws Exception { try { String nameInNamespace; if (nameCtx != null) { nameInNamespace = nameCtx.getNameInNamespace(); } else { nameInNamespace = ""; } return constructAdapterFromName(attrs, name, nameInNamespace); } finally { if (obj instanceof Context) { Context ctx = (Context) obj; try { ctx.close(); } catch (Exception e) { } } } } }
DefaultDirObjectFactory implements DirObjectFactory { @Override public final Object getObjectInstance( Object obj, Name name, Context nameCtx, Hashtable<?, ?> environment, Attributes attrs) throws Exception { try { String nameInNamespace; if (nameCtx != null) { nameInNamespace = nameCtx.getNameInNamespace(); } else { nameInNamespace = ""; } return constructAdapterFromName(attrs, name, nameInNamespace); } finally { if (obj instanceof Context) { Context ctx = (Context) obj; try { ctx.close(); } catch (Exception e) { } } } }  }
DefaultDirObjectFactory implements DirObjectFactory { @Override public final Object getObjectInstance( Object obj, Name name, Context nameCtx, Hashtable<?, ?> environment, Attributes attrs) throws Exception { try { String nameInNamespace; if (nameCtx != null) { nameInNamespace = nameCtx.getNameInNamespace(); } else { nameInNamespace = ""; } return constructAdapterFromName(attrs, name, nameInNamespace); } finally { if (obj instanceof Context) { Context ctx = (Context) obj; try { ctx.close(); } catch (Exception e) { } } } }  @Override final Object getObjectInstance(
            Object obj,
            Name name,
            Context nameCtx,
            Hashtable<?, ?> environment,
            Attributes attrs); @Override Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?, ?> environment); }
DefaultDirObjectFactory implements DirObjectFactory { @Override public final Object getObjectInstance( Object obj, Name name, Context nameCtx, Hashtable<?, ?> environment, Attributes attrs) throws Exception { try { String nameInNamespace; if (nameCtx != null) { nameInNamespace = nameCtx.getNameInNamespace(); } else { nameInNamespace = ""; } return constructAdapterFromName(attrs, name, nameInNamespace); } finally { if (obj instanceof Context) { Context ctx = (Context) obj; try { ctx.close(); } catch (Exception e) { } } } }  @Override final Object getObjectInstance(
            Object obj,
            Name name,
            Context nameCtx,
            Hashtable<?, ?> environment,
            Attributes attrs); @Override Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?, ?> environment); static final String JNDI_ENV_BASE_PATH_KEY; }