ImmutableRoot implements Root, ReadOnly { @NotNull @Override public ContentSession getContentSession() { return new ContentSession() { @Override public @NotNull AuthInfo getAuthInfo() { return authInfo; } @Override public String getWorkspaceName() { return wspName; } @Override public @NotNull Root getLatestRoot() { return ImmutableRoot.this; } @Override public void close() { } }; } ImmutableRoot(@NotNull NodeState rootState);  ImmutableRoot(@NotNull Root root);  ImmutableRoot(@NotNull ImmutableTree rootTree); static ImmutableRoot getInstance(@NotNull Root root); @NotNull @Override ImmutableTree getTree(@NotNull String path); @Override boolean move(String sourcePath, String destPath); @Override void rebase(); @Override void refresh(); @Override void commit(@NotNull Map<String, Object> info); @Override void commit(); @Override boolean hasPendingChanges(); @NotNull @Override QueryEngine getQueryEngine(); @Override @NotNull Blob createBlob(@NotNull InputStream stream); @Override Blob getBlob(@NotNull String reference); @NotNull @Override ContentSession getContentSession();  }
@Test public void testGetContentSession() { ContentSession cs = root.getContentSession(); assertNotEquals(adminSession, cs); assertSame(adminSession.getAuthInfo(), cs.getAuthInfo()); assertEquals(adminSession.getWorkspaceName(), cs.getWorkspaceName()); assertSame(root, cs.getLatestRoot()); }
@Test public void testGetContentSessionCreatedFromImmutableRoot() { ImmutableRoot ir = new ImmutableRoot(root); ContentSession cs = ir.getContentSession(); assertSame(root.getContentSession().getAuthInfo(), cs.getAuthInfo()); assertEquals(root.getContentSession().getWorkspaceName(), cs.getWorkspaceName()); try { cs.close(); } catch (IOException e) { fail(); } }