@Override
public int getStatusCode()
{
- return Response.Status.INTERNAL_SERVER_ERROR.getStatusCode();
+ return e.getHttpErrorCode();
}
@Override
public Response.Status.Family getFamily()
{
- return Response.Status.Family.SERVER_ERROR;
+ return Response.Status.Family.familyOf( e.getHttpErrorCode() );
}
@Override
{
return e.getMessage();
}
- } ).build();
+ } )//
+ .entity( restError ) //
+ .build();
return response;
}
import org.apache.commons.io.FileUtils;
import org.junit.Test;
+import javax.ws.rs.BadRequestException;
import javax.ws.rs.ForbiddenException;
+import javax.ws.rs.core.Response;
import java.io.File;
import java.util.List;
}
}
- @Test( expected = ForbiddenException.class )
+ @Test( expected = BadRequestException.class )
public void deleteWithRepoNull()
throws Exception
{
repositoriesService.deleteArtifact( artifact );
}
- catch ( ForbiddenException e )
+ catch ( BadRequestException e )
{
- assertEquals( "not http 400 status", 400, e.getResponse().getStatus() );
+ assertEquals( "not http " + Response.Status.BAD_REQUEST.getStatusCode() + " status",
+ Response.Status.BAD_REQUEST.getStatusCode(), e.getResponse().getStatus() );
throw e;
}
}