Buggy code:
@ Listeners ( { MockitoTestNGListener . class } ) public class RunQueueTest { private DtoFactory dtoFactory = DtoFactory . getInstance ( ) ; private HttpJsonHelperImpl httpJsonHelper ; private RunQueue runQueue ; private String wsId = "my_ws" ; private String wsName = wsId ; private String pName = "my_project" ; private String pPath = "//" + ( pName ) ; private ProjectDescriptor project ; private WorkspaceDescriptor workspace ; private EnvironmentContext codenvyContext ; private List < RunnerEvent > events = new CopyOnWriteArrayList < > ( ) ; @ BeforeMethod public void beforeMethod ( ) throws Exception { } @ AfterMethod public void afterMethod ( ) { } @ Test public void testRegisterSlaveRunner ( ) throws Exception { } @ Test public void testRegisterSlaveRunnerWithRunnerServerAccessCriteria ( ) throws Exception { } @ Test public void testRegisterSlaveRunnerWithMoreThenOneInfra ( ) throws Exception { } @ Test public void testUnregisterSlaveRunner ( ) throws Exception { } @ Test ( expectedExceptions = { RunnerException . class } , expectedExceptionsMessageRegExp = "Runner<seq2seq4repair_space>environment<seq2seq4repair_space>'system://java//web//jboss7'<seq2seq4repair_space>is<seq2seq4repair_space>not<seq2seq4repair_space>available<seq2seq4repair_space>for<seq2seq4repair_space>workspace<seq2seq4repair_space>'my_ws'<seq2seq4repair_space>on<seq2seq4repair_space>infra<seq2seq4repair_space>'community'." ) public void testRunWhenReadRunnerConfigurationFromProject_RunnerIsNotAvailable ( ) throws Exception { } @ Test public void testRunWhenReadRunnerConfigurationFromProject ( ) throws Exception { } @ Test public void testRunWithRunOptions ( ) throws Exception { } @ Test public void testRunWithCustomEnvironment ( ) throws Exception { String remoteUrl = "http:////localhost:8080//api//internal//runner" ; RunnerDescriptor runnerDescriptor = dto ( RunnerDescriptor . class ) . withName ( "docker" ) ; RemoteRunnerServer runnerServer = registerRunnerServer ( remoteUrl , runnerDescriptor , null ) ; RemoteRunner runner = runnerServer . getRemoteRunner ( runnerDescriptor . getName ( ) ) ; doReturn ( dto ( RunnerState . class ) . withServerState ( dto ( ServerState . class ) . withFreeMemory ( 512 ) ) ) . when ( runner ) . getRemoteRunnerState ( ) ; RemoteRunnerProcess process = spy ( new RemoteRunnerProcess ( runnerServer . getBaseUrl ( ) , runner . getName ( ) , 1L ) ) ; doReturn ( process ) . when ( runner ) . run ( any ( RunRequest . class ) ) ; ServiceContext serviceContext = newServiceContext ( ) ; String envName = "my_env_1" ; RunOptions runOptions = mock ( RunOptions . class ) ; doReturn ( ( "project:////" + envName ) ) . when ( runOptions ) . getEnvironmentId ( ) ; doReturn ( project ) . when ( runQueue ) . getProjectDescriptor ( wsId , pPath , serviceContext ) ; doReturn ( workspace ) . when ( runQueue ) . getWorkspaceDescriptor ( wsId , serviceContext ) ; doNothing ( ) . when ( runQueue ) . checkResources ( eq ( workspace ) , any ( RunRequest . class ) ) ; <START_BUG> ItemReference recipe = dto ( ItemReference . class ) . withName ( "Dockerfile" ) . withType ( "file" ) ; <END_BUG> String recipeUrl = String . format ( "http:////localhost:8080//api//project//%s//.codenvy//runners//environments//%s" , wsId , envName ) ; recipe . getLinks ( ) . add ( dto ( Link . class ) . withRel ( LINK_REL_GET_CONTENT ) . withHref ( recipeUrl ) ) ; doReturn ( Arrays . asList ( recipe ) ) . when ( runQueue ) . getProjectRunnerRecipes ( eq ( project ) , eq ( envName ) ) ; runQueue . run ( wsId , pPath , serviceContext , runOptions ) ; ArgumentCaptor < RunRequest > runRequestCaptor = ArgumentCaptor . forClass ( RunRequest . class ) ; verify ( runner , timeout ( 1000 ) ) . run ( runRequestCaptor . capture ( ) ) ; RunRequest request = runRequestCaptor . getValue ( ) ; assertNull ( request . getEnvironmentId ( ) ) ; assertEquals ( request . getRunner ( ) , "docker" ) ; List < String > recipeUrls = request . getRecipeUrls ( ) ; assertEquals ( recipeUrls . size ( ) , 1 ) ; assertEquals ( request . getUserToken ( ) , codenvyContext . getUser ( ) . getToken ( ) ) ; checkEvents ( RUN_TASK_ADDED_IN_QUEUE ) ; } @ Test public void testTimeOutWhileWaitingForRunner ( ) throws Exception { } @ Test public void testRunWithBuildBefore ( ) throws Exception { } @ Test public void testOverrideBuilderWithRunOptions ( ) throws Exception { } @ Test public void testSkipBuildNoBuilderName ( ) throws Exception { } @ Test public void testSkipBuildWithSkipBuildOptions ( ) throws Exception { } @ Test public void testTimeOutWhileWaitingForLongBuildProcess ( ) throws Exception { } @ Test ( expectedExceptions = { RunnerException . class } , expectedExceptionsMessageRegExp = "Not<seq2seq4repair_space>enough<seq2seq4repair_space>resources<seq2seq4repair_space>to<seq2seq4repair_space>start<seq2seq4repair_space>application.<seq2seq4repair_space>Available<seq2seq4repair_space>memory<seq2seq4repair_space>128M<seq2seq4repair_space>but<seq2seq4repair_space>256M<seq2seq4repair_space>required." ) public void testErrorWhenNotEnoughMemoryAssignedToWorkspace ( ) throws Exception { } @ Test ( expectedExceptions = { RunnerException . class } , expectedExceptionsMessageRegExp = "Not<seq2seq4repair_space>enough<seq2seq4repair_space>resources<seq2seq4repair_space>to<seq2seq4repair_space>start<seq2seq4repair_space>application.<seq2seq4repair_space>Available<seq2seq4repair_space>memory<seq2seq4repair_space>128M<seq2seq4repair_space>but<seq2seq4repair_space>129M<seq2seq4repair_space>required." ) public void testErrorWhenNotEnoughMemoryToRunNewApplication ( ) throws Exception { } @ Test public void testWhenRunningOutOfDiskSpace ( ) throws Exception { } private String mockBuilderApi ( final int inProgressNum ) throws Exception { } private void checkEvents ( RunnerEvent ... expected ) { } private ServiceContext newServiceContext ( ) { } private < T > T dto ( Class < T > type ) { } private RemoteRunnerServer registerDefaultRunnerServer ( ) throws Exception { } private RemoteRunnerServer registerRunnerServer ( String remoteUrl , RunnerDescriptor runnerDescriptor , RunnerServerAccessCriteria accessRules ) throws Exception { } }

Fix:
ItemReference recipe = dto ( ItemReference . class ) . withName ( "Dockerfile" ) . withItemType ( "file" ) ;