Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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