RepositoryBackedSession { public void removeAttribute(String name) { assertValid(); Attribute attr = getAttributeFromCache(name); if (attr == null) { attr = retrieveAttribute(name, null); if (attr == null) { return; } } if (sessionData.isNonCacheable(name)) { manager.getRepository().removeSessionAttribute(sessionData, name); } Object oldValue = attr.value; attr.value = null; attr.deleted = true; attr.changed = true; dirty = true; checkUsedAndLock(); if (oldValue != null) { manager.getNotifier().attributeRemoved(this, name, oldValue); } } RepositoryBackedSession(SessionData sessionData, SessionManager manager, SessionFactory factory); protected  RepositoryBackedSession(RepositoryBackedSession linked); void setMaxInactiveInterval(int maxInactiveInterval); Object getAttribute(String key); @SuppressWarnings({ "rawtypes" }) Enumeration getAttributeNames(); List<String> getAttributeNamesWithValues(); long getCreationTime(); String getId(); long getLastAccessedTime(); int getMaxInactiveInterval(); void invalidate(); void doInvalidate(boolean expired); boolean isNew(); void removeAttribute(String name); Attribute getAttributeFromCache(String name); void setAttribute(String key, Object value); synchronized void commit(); boolean isValid(); boolean isExpired(); boolean isDirty(); Runnable getCommitter(); SessionData getSessionData(); boolean isCommitted(); void setCommitted(boolean committed); SessionManager getSessionManager(); int getConcurrentUses();  }
@Test public void testRemoveAttribute() { RepositoryBackedSession rbs = new RepositoryBackedSession(sessionData, manager, factory); rbs.setAttribute("Test", "value"); rbs.removeAttribute("Test"); verify(notifier).attributeRemoved(refEq(rbs), eq("Test"), eq("value")); assertNull(rbs.getAttribute("Test")); }