Skip to content

Instantly share code, notes, and snippets.

@miyajan
Created July 28, 2016 09:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save miyajan/703d52d1ec449a16f29ed31c6e89865e to your computer and use it in GitHub Desktop.
Save miyajan/703d52d1ec449a16f29ed31c6e89865e to your computer and use it in GitHub Desktop.
Jenkins JUnit Attachments Bug Reproduction Test (404 error with '%' character)
package com.example.miyata;
import static org.junit.Assert.fail;
import java.io.File;
import java.net.URL;
import org.apache.commons.io.FileUtils;
import org.junit.Test;
public class AttachmentsTest
{
@Test
public void testScreenshot() throws Exception
{
File outputDirectory = new File( "target/attachments",
getClass().getName() );
FileUtils.forceMkdir( outputDirectory );
File screenFile = new File( outputDirectory, "100%.png" );
FileUtils.copyURLToFile(
new URL( "https://wiki.jenkins-ci.org/download/attachments/2916393/logo.png?version=1&modificationDate=1302753947000" ),
screenFile );
System.err.println("[[ATTACHMENT|" + screenFile.getAbsolutePath() + "]]");
fail();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment