Buggy code:
Assert . assertFalse ( response . containsHeader ( CREATED_SESSIONS ) ) ; Assert . assertFalse ( response . containsHeader ( DESTROYED_SESSIONS ) ) ; Assert . assertFalse ( response . containsHeader ( ADDED_ATTRIBUTES ) ) ; Assert . assertFalse ( response . containsHeader ( REPLACED_ATTRIBUTES ) ) ; Assert . assertTrue ( response . containsHeader ( REMOVED_ATTRIBUTES ) ) ; Assert . assertFalse ( response . containsHeader ( BOUND_ATTRIBUTES ) ) ; Assert . assertTrue ( response . containsHeader ( UNBOUND_ATTRIBUTES ) ) ; Assert . assertEquals ( "a" , response . getFirstHeader ( REMOVED_ATTRIBUTES ) . getValue ( ) ) ; Assert . assertEquals ( "4" , response . getFirstHeader ( UNBOUND_ATTRIBUTES ) . getValue ( ) ) ; } finally { org . apache . http . client . utils . HttpClientUtils . closeQuietly ( response ) ; } response = client . execute ( new org . apache . http . client . methods . HttpGet ( SessionOperationServlet . createGetURI ( baseURL2 , "a" ) ) ) ; try { Assert . assertEquals ( SC_OK , response . getStatusLine ( ) . getStatusCode ( ) ) ; Assert . assertFalse ( response . containsHeader ( RESULT ) ) ; Assert . assertFalse ( response . containsHeader ( CREATED_SESSIONS ) ) ; Assert . assertFalse ( response . containsHeader ( DESTROYED_SESSIONS ) ) ; Assert . assertFalse ( response . containsHeader ( ADDED_ATTRIBUTES ) ) ; Assert . assertFalse ( response . containsHeader ( REPLACED_ATTRIBUTES ) ) ; Assert . assertFalse ( response . containsHeader ( REMOVED_ATTRIBUTES ) ) ; Assert . assertFalse ( response . containsHeader ( BOUND_ATTRIBUTES ) ) ; Assert . assertFalse ( response . containsHeader ( UNBOUND_ATTRIBUTES ) ) ; } finally { org . apache . http . client . utils . HttpClientUtils . closeQuietly ( response ) ; } response = client . execute ( new org . apache . http . client . methods . HttpGet ( SessionOperationServlet . createSetURI ( baseURL2 , "a" , "5" ) ) ) ; try { Assert . assertEquals ( SC_OK , response . getStatusLine ( ) . getStatusCode ( ) ) ; Assert . assertTrue ( response . containsHeader ( SESSION_ID ) ) ; Assert . assertFalse ( response . containsHeader ( CREATED_SESSIONS ) ) ; Assert . assertFalse ( response . containsHeader ( DESTROYED_SESSIONS ) ) ; Assert . assertTrue ( response . containsHeader ( ADDED_ATTRIBUTES ) ) ; Assert . assertFalse ( response . containsHeader ( REPLACED_ATTRIBUTES ) ) ; Assert . assertFalse ( response . containsHeader ( REMOVED_ATTRIBUTES ) ) ; Assert . assertTrue ( response . containsHeader ( BOUND_ATTRIBUTES ) ) ; Assert . assertFalse ( response . containsHeader ( UNBOUND_ATTRIBUTES ) ) ; Assert . assertEquals ( "a" , response . getFirstHeader ( ADDED_ATTRIBUTES ) . getValue ( ) ) ; Assert . assertEquals ( "5" , response . getFirstHeader ( BOUND_ATTRIBUTES ) . getValue ( ) ) ; } finally { org . apache . http . client . utils . HttpClientUtils . closeQuietly ( response ) ; } response = client . execute ( new org . apache . http . client . methods . HttpGet ( SessionOperationServlet . createInvalidateURI ( baseURL1 ) ) ) ; try { Assert . assertEquals ( SC_OK , response . getStatusLine ( ) . getStatusCode ( ) ) ; Assert . assertTrue ( response . containsHeader ( SESSION_ID ) ) ; Assert . assertFalse ( response . containsHeader ( CREATED_SESSIONS ) ) ; Assert . assertTrue ( response . containsHeader ( DESTROYED_SESSIONS ) ) ; Assert . assertFalse ( response . containsHeader ( ADDED_ATTRIBUTES ) ) ; Assert . assertFalse ( response . containsHeader ( REPLACED_ATTRIBUTES ) ) ; <START_BUG> Assert . assertFalse ( response . containsHeader ( REMOVED_ATTRIBUTES ) ) ; <END_BUG> Assert . assertFalse ( response . containsHeader ( BOUND_ATTRIBUTES ) ) ; Assert . assertTrue ( response . containsHeader ( UNBOUND_ATTRIBUTES ) ) ; Assert . assertEquals ( response . getFirstHeader ( SESSION_ID ) . getValue ( ) , response . getFirstHeader ( DESTROYED_SESSIONS ) . getValue ( ) ) ; Assert . assertEquals ( "5" , response . getFirstHeader ( UNBOUND_ATTRIBUTES ) . getValue ( ) ) ; } finally { org . apache . http . client . utils . HttpClientUtils . closeQuietly ( response ) ; } response = client . execute ( new org . apache . http . client . methods . HttpGet ( SessionOperationServlet . createSetURI ( baseURL2 , "a" , "6" ) ) ) ; try { Assert . assertEquals ( SC_OK , response . getStatusLine ( ) . getStatusCode ( ) ) ; Assert . assertTrue ( response . containsHeader ( SESSION_ID ) ) ; Assert . assertTrue ( response . containsHeader ( CREATED_SESSIONS ) ) ; Assert . assertFalse ( response . containsHeader ( DESTROYED_SESSIONS ) ) ; Assert . assertTrue ( response . containsHeader ( ADDED_ATTRIBUTES ) ) ; Assert . assertFalse ( response . containsHeader ( REPLACED_ATTRIBUTES ) ) ; Assert . assertFalse ( response . containsHeader ( REMOVED_ATTRIBUTES ) ) ; Assert . assertTrue ( response . containsHeader ( BOUND_ATTRIBUTES ) ) ; Assert . assertFalse ( response . containsHeader ( UNBOUND_ATTRIBUTES ) ) ; Assert . assertEquals ( response . getFirstHeader ( SESSION_ID ) . getValue ( ) , response . getFirstHeader ( CREATED_SESSIONS ) . getValue ( ) ) ; Assert . assertEquals ( "a" , response . getFirstHeader ( ADDED_ATTRIBUTES ) . getValue ( ) ) ; Assert . assertEquals ( "6" , response . getFirstHeader ( BOUND_ATTRIBUTES ) . getValue ( ) ) ; } finally { org . apache . http . client . utils . HttpClientUtils . closeQuietly ( response ) ; } response = client . execute ( new org . apache . http . client . methods . HttpGet ( SessionOperationServlet . createGetURI ( baseURL2 , "a" , "7" ) ) ) ;

Fix:
Assert . assertEquals ( "a" , response . getFirstHeader ( REMOVED_ATTRIBUTES ) . getValue ( ) ) ;