### Question:
UrlRewriteServletEnvironment implements UrlRewriteEnvironment { @Override public <T> T getAttribute( String name ) { return (T)context.getAttribute( name ); } UrlRewriteServletEnvironment( ServletContext context ); @Override URL getResource( String name ); @Override T getAttribute( String name ); @Override List<String> resolve( String name );  }### Answer:
@Test public void testGetAttribute() throws Exception { ServletContext context = EasyMock.createNiceMock( ServletContext.class ); EasyMock.expect( context.getAttribute( "test-attribute-name" ) ).andReturn( "test-attribute-value" ).anyTimes(); EasyMock.replay( context ); UrlRewriteServletEnvironment env = new UrlRewriteServletEnvironment( context ); assertThat(env.getAttribute( "test-attribute-name" ), is( "test-attribute-value" ) ); }