Code example for TreeSet

0
    } 
     
    @Test 
    public void getAttributeNames() { 
        SessionAttributes attributes = mock(SessionAttributes.class);
        Set<String> expected = new TreeSet<String>();
         
        when(this.session.getAttributes()).thenReturn(attributes);
        when(attributes.getAttributeNames()).thenReturn(expected);
         
        Enumeration<String> result = this.httpSession.getAttributeNames();
         
        assertEquals(new ArrayList<>(expected), Collections.list(result));
    } 
 
    @Test 
    public void getAttribute() { 
        SessionAttributes attributes = mock(SessionAttributes.class);
        String name = "name";
        Object expected = new Object();