WebRequest request = new PutMethodWebRequest( putUrl, is, "text/plain" );
WebResponse response = sc.getResponse( request );
- assertResponseBadRequest( response );
+ assertResponseMethodNotAllowed( response );
}
public void testBrowseRepositoryGroup()
assertEquals( "Should have been an 401 response code.", HttpServletResponse.SC_UNAUTHORIZED, response.getResponseCode() );
}
- protected void assertResponseBadRequest( WebResponse response )
+ protected void assertResponseMethodNotAllowed( WebResponse response )
{
assertNotNull( "Should have recieved a response", response );
- assertEquals( "Should have been an 400/Bad Request response code.", HttpServletResponse.SC_BAD_REQUEST, response.getResponseCode() );
+ assertEquals( "Should have been an 405/Method Not Allowed response code.", HttpServletResponse.SC_METHOD_NOT_ALLOWED, response.getResponseCode() );
}
protected RepositoryGroupConfiguration createRepositoryGroup( String id, List<String> repositories )
{
if( WebdavMethodUtil.isWriteMethod( request.getMethod() ) )
{
- throw new DavException( HttpServletResponse.SC_BAD_REQUEST, "Bad request to repository group <" +
- repoGroupConfig.getId() + ">" );
+ throw new DavException( HttpServletResponse.SC_METHOD_NOT_ALLOWED,
+ "Write method not allowed for repository groups." );
}
repositories.addAll( repoGroupConfig.getRepositories() );