Program: 20677
Project: 20677
Buggy source:
@Before public void setUp() throws Exception {
  super.setUp();
  requestControl=MockControl.createControl(DavServletRequest.class);
  request=(DavServletRequest)requestControl.getMock();
  responseControl=MockControl.createControl(DavServletResponse.class);
  response=(DavServletResponse)responseControl.getMock();
  responseControl.setDefaultMatcher(MockControl.ALWAYS_MATCHER);
  archivaConfigurationControl=MockControl.createControl(ArchivaConfiguration.class);
  archivaConfiguration=(ArchivaConfiguration)archivaConfigurationControl.getMock();
  config=new Configuration();
  archivaConfiguration.getConfiguration();
  archivaConfigurationControl.setReturnValue(config,5,20);
  archivaConfiguration.save(config);
  archivaConfigurationControl.setVoidCallable(1,4);
  archivaConfigurationControl.replay();
  defaultManagedRepositoryAdmin.setArchivaConfiguration(archivaConfiguration);
  defaultManagedRepositoryAdmin.getRepositoryCommonValidator().setArchivaConfiguration(archivaConfiguration);
  if (defaultManagedRepositoryAdmin.getManagedRepository(RELEASES_REPO) == null) {
    defaultManagedRepositoryAdmin.addManagedRepository(createManagedRepository(RELEASES_REPO,new File("String_Node_Str" + RELEASES_REPO).getPath(),"String_Node_Str"),false,null);
  }
  if (defaultManagedRepositoryAdmin.getManagedRepository(INTERNAL_REPO) == null) {
    defaultManagedRepositoryAdmin.addManagedRepository(createManagedRepository(INTERNAL_REPO,new File("String_Node_Str" + INTERNAL_REPO).getPath(),"String_Node_Str"),false,null);
  }
  RepositoryGroup repoGroupConfig=new RepositoryGroup();
  repoGroupConfig.setId(LOCAL_REPO_GROUP);
  repoGroupConfig.addRepository(RELEASES_REPO);
  repoGroupConfig.addRepository(INTERNAL_REPO);
  defaultRepositoryGroupAdmin.setArchivaConfiguration(archivaConfiguration);
  if (defaultManagedRepositoryAdmin.getManagedRepository(LOCAL_REPO_GROUP) == null) {
    defaultRepositoryGroupAdmin.addRepositoryGroup(repoGroupConfig,null);
  }
  repoContentFactoryControl=MockClassControl.createControl(RepositoryContentFactory.class);
  repoFactory=(RepositoryContentFactory)repoContentFactoryControl.getMock();
  repoRequestControl=MockClassControl.createControl(RepositoryRequest.class);
  repoRequest=(RepositoryRequest)repoRequestControl.getMock();
  resourceFactory=new OverridingArchivaDavResourceFactory(applicationContext,plexusSisuBridge,archivaConfiguration);
  resourceFactory.setArchivaConfiguration(archivaConfiguration);
  resourceFactory.setRepositoryFactory(repoFactory);
  resourceFactory.setRepositoryRequest(repoRequest);
  resourceFactory.setConnectors(new OverridingRepositoryProxyConnectors());
}

Fixed version (ground truth):
@Before public void setUp() throws Exception {
  super.setUp();
  requestControl=MockControl.createControl(DavServletRequest.class);
  request=(DavServletRequest)requestControl.getMock();
  responseControl=MockControl.createControl(DavServletResponse.class);
  response=(DavServletResponse)responseControl.getMock();
  responseControl.setDefaultMatcher(MockControl.ALWAYS_MATCHER);
  archivaConfigurationControl=MockControl.createControl(ArchivaConfiguration.class);
  archivaConfiguration=(ArchivaConfiguration)archivaConfigurationControl.getMock();
  config=new Configuration();
  archivaConfiguration.getConfiguration();
  archivaConfigurationControl.setReturnValue(config,5,20);
  archivaConfiguration.save(config);
  archivaConfigurationControl.setVoidCallable(1,4);
  archivaConfigurationControl.replay();
  defaultManagedRepositoryAdmin.setArchivaConfiguration(archivaConfiguration);
  ((DefaultRepositoryCommonValidator)defaultManagedRepositoryAdmin.getRepositoryCommonValidator()).setArchivaConfiguration(archivaConfiguration);
  if (defaultManagedRepositoryAdmin.getManagedRepository(RELEASES_REPO) == null) {
    defaultManagedRepositoryAdmin.addManagedRepository(createManagedRepository(RELEASES_REPO,new File("String_Node_Str" + RELEASES_REPO).getPath(),"String_Node_Str"),false,null);
  }
  if (defaultManagedRepositoryAdmin.getManagedRepository(INTERNAL_REPO) == null) {
    defaultManagedRepositoryAdmin.addManagedRepository(createManagedRepository(INTERNAL_REPO,new File("String_Node_Str" + INTERNAL_REPO).getPath(),"String_Node_Str"),false,null);
  }
  RepositoryGroup repoGroupConfig=new RepositoryGroup();
  repoGroupConfig.setId(LOCAL_REPO_GROUP);
  repoGroupConfig.addRepository(RELEASES_REPO);
  repoGroupConfig.addRepository(INTERNAL_REPO);
  defaultRepositoryGroupAdmin.setArchivaConfiguration(archivaConfiguration);
  if (defaultManagedRepositoryAdmin.getManagedRepository(LOCAL_REPO_GROUP) == null) {
    defaultRepositoryGroupAdmin.addRepositoryGroup(repoGroupConfig,null);
  }
  repoContentFactoryControl=MockClassControl.createControl(RepositoryContentFactory.class);
  repoFactory=(RepositoryContentFactory)repoContentFactoryControl.getMock();
  repoRequestControl=MockClassControl.createControl(RepositoryRequest.class);
  repoRequest=(RepositoryRequest)repoRequestControl.getMock();
  resourceFactory=new OverridingArchivaDavResourceFactory(applicationContext,plexusSisuBridge,archivaConfiguration);
  resourceFactory.setArchivaConfiguration(archivaConfiguration);
  resourceFactory.setRepositoryFactory(repoFactory);
  resourceFactory.setRepositoryRequest(repoRequest);
  resourceFactory.setConnectors(new OverridingRepositoryProxyConnectors());
}