Buggy code:
public class RestTemplateIntegrationTests { private RestTemplate template ; private static Server jettyServer ; private static String helloWorld = "Héllo<seq2seq4repair_space>Wörld" ; private static String baseUrl ; private static MediaType contentType ; @ BeforeClass public static void startJettyServer ( ) throws Exception { } @ Before public void createTemplate ( ) { } @ AfterClass public static void stopJettyServer ( ) throws Exception { } @ Test public void getString ( ) { } @ Test public void getEntity ( ) { } @ Test public void getNoResponse ( ) { } @ Test public void getNoContentTypeHeader ( ) throws UnsupportedEncodingException { } @ Test public void getNoContent ( ) { } @ Test public void getNotModified ( ) { } @ Test public void postForLocation ( ) throws URISyntaxException { } @ Test public void postForLocationEntity ( ) throws URISyntaxException { } @ Test public void postForObject ( ) throws URISyntaxException { } @ Test public void notFound ( ) { } @ Test public void serverError ( ) { } @ Test public void optionsForAllow ( ) throws URISyntaxException { } @ Test public void uri ( ) throws InterruptedException , URISyntaxException { } @ Test public void multipart ( ) throws UnsupportedEncodingException { } @ Test public void exchangeGet ( ) throws Exception { } @ Test public void exchangePost ( ) throws Exception { HttpHeaders requestHeaders = new HttpHeaders ( ) ; requestHeaders . set ( "MyHeader" , "MyValue" ) ; requestHeaders . setContentType ( TEXT_PLAIN ) ; HttpEntity < String > requestEntity = new HttpEntity < String > ( RestTemplateIntegrationTests . helloWorld , requestHeaders ) ; <START_BUG> HttpEntity < ? > result = template . exchange ( ( ( RestTemplateIntegrationTests . baseUrl ) + "//{method}" ) , POST , requestEntity , null , "post" ) ; <END_BUG> assertEquals ( "Invalid<seq2seq4repair_space>location" , new URI ( ( ( RestTemplateIntegrationTests . baseUrl ) + "//post//1" ) ) , result . getHeaders ( ) . getLocation ( ) ) ; assertFalse ( result . hasBody ( ) ) ; } private static class StatusCodeServlet extends GenericServlet { private final int sc ; private StatusCodeServlet ( int sc ) { } @ Override public void service ( ServletRequest request , ServletResponse response ) throws IOException , ServletException { } } private static class ErrorServlet extends GenericServlet { private final int sc ; private ErrorServlet ( int sc ) { } @ Override public void service ( ServletRequest request , ServletResponse response ) throws IOException , ServletException { } } private static class GetServlet extends HttpServlet { private final byte [ ] buf ; private final MediaType contentType ; private GetServlet ( byte [ ] buf , MediaType contentType ) { } @ Override protected void doGet ( HttpServletRequest request , HttpServletResponse response ) throws IOException , ServletException { } } private static class PostServlet extends HttpServlet { private final String s ; private final String location ; private final byte [ ] buf ; private final MediaType contentType ; private PostServlet ( String s , String location , byte [ ] buf , MediaType contentType ) { } @ Override protected void doPost ( HttpServletRequest request , HttpServletResponse response ) throws IOException , ServletException { } } private static class UriServlet extends HttpServlet { @ Override protected void doGet ( HttpServletRequest req , HttpServletResponse resp ) throws IOException , ServletException { } } private static class MultipartServlet extends HttpServlet { @ Override protected void doPost ( HttpServletRequest req , HttpServletResponse resp ) throws IOException , ServletException { } } }

Fix:
HttpEntity < Void > result = template . exchange ( ( ( RestTemplateIntegrationTests . baseUrl ) + "//{method}" ) , POST , requestEntity , Void . class , "post" ) ;