auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testNotNot ( ) { final com.google.gerrit.server.query.NotPredicateTest.TestPredicate p = com.google.gerrit.server.query.NotPredicateTest.f ( "author" , "bob" ) ; final com.google.gerrit.server.query.Predicate < java.lang.String > n = com.google.gerrit.server.query.Predicate.not ( p ) ; org.junit.Assert.assertTrue ( ( n instanceof com.google.gerrit.server.query.NotPredicate ) ) ; org.junit.Assert.assertNotSame ( p , n ) ; org.junit.Assert.assertSame ( p , com.google.gerrit.server.query.Predicate.not ( n ) ) ; }

Target:
public void testNotNot ( ) { final com.google.gerrit.server.query.TestPredicate p = f ( "author" , "bob" ) ; final com.google.gerrit.server.query.Predicate < java.lang.String > n = com.google.gerrit.server.query.Predicate.not ( p ) ; org.junit.Assert.assertTrue ( ( n instanceof com.google.gerrit.server.query.NotPredicate ) ) ; org.junit.Assert.assertNotSame ( p , n ) ; org.junit.Assert.assertSame ( p , com.google.gerrit.server.query.Predicate.not ( n ) ) ; }
Source:
private java.lang.Iterable < com.google.gerrit.reviewdb.client.PatchSetApproval > safeGetApprovals ( com.google.gerrit.server.git.CodeReviewCommit n ) { try { return approvalsUtil.byPatchSet ( db.get ( ) , n.getControl ( ) , n.getPatchsetId ( ) ) ; } catch ( com.google.gwtorm.server.OrmException e ) { com.google.gerrit.server.git.MergeUtil.log.error ( ( "Can't read approval records for " + ( n.getPatchsetId ( ) ) ) , e ) ; return java.util.Collections.emptyList ( ) ; } }

Target:
public java.lang.String createCherryPickCommitMessage ( final com.google.gerrit.server.git.CodeReviewCommit n ) { return createCherryPickCommitMessage ( n , n.getControl ( ) , n.getPatchsetId ( ) ) ; }
Source:
public void testKeyObjectId ( ) throws java.lang.Exception { org.bouncycastle.openpgp.PGPPublicKey key = com.google.gerrit.server.git.gpg.TestKey.key1 ( ) . getPublicKey ( ) ; java.lang.String objId = com.google.gerrit.server.git.gpg.PublicKeyStore.keyObjectId ( key.getKeyID ( ) ) . name ( ) ; org.junit.Assert.assertEquals ( "ed0625dc46328a8c000000000000000000000000" , objId ) ; org.junit.Assert.assertEquals ( com.google.gerrit.server.git.gpg.PublicKeyStore.keyIdToString ( key.getKeyID ( ) ) . toLowerCase ( ) , objId.substring ( 8 , 16 ) ) ; }

Target:
public void testKeyObjectId ( ) throws java.lang.Exception { org.bouncycastle.openpgp.PGPPublicKey key = com.google.gerrit.gpg.testutil.TestKey.key1 ( ) . getPublicKey ( ) ; java.lang.String objId = com.google.gerrit.gpg.PublicKeyStore.keyObjectId ( key.getKeyID ( ) ) . name ( ) ; org.junit.Assert.assertEquals ( "ed0625dc46328a8c000000000000000000000000" , objId ) ; org.junit.Assert.assertEquals ( com.google.gerrit.gpg.PublicKeyStore.keyIdToString ( key.getKeyID ( ) ) . toLowerCase ( ) , objId.substring ( 8 , 16 ) ) ; }
Source:
public void duplicateCompoundIndexOnlyPredicates ( ) throws java.lang.Exception { com.google.gerrit.server.query.Predicate < com.google.gerrit.server.query.change.ChangeData > in = parse ( "(status:new OR file:a) bar:p file:b" ) ; com.google.gerrit.server.query.Predicate < com.google.gerrit.server.query.change.ChangeData > out = rewrite ( in ) ; com.google.common.truth.Truth.assertThat ( out.getClass ( ) ) . isEqualTo ( com.google.gerrit.server.query.change.AndChangeSource.class ) ; com.google.common.truth.Truth.assertThat ( out.getChildren ( ) ) . containsExactly ( query ( com.google.gerrit.server.query.Predicate.and ( in.getChild ( 0 ) , in.getChild ( 2 ) ) ) , in.getChild ( 1 ) ) . inOrder ( ) ; }

Target:
public void duplicateCompoundIndexOnlyPredicates ( ) throws java.lang.Exception { com.google.gerrit.index.query.Predicate < com.google.gerrit.server.query.change.ChangeData > in = parse ( "(status:new OR file:a) bar:p file:b" ) ; com.google.gerrit.index.query.Predicate < com.google.gerrit.server.query.change.ChangeData > out = rewrite ( in ) ; com.google.common.truth.Truth.assertThat ( out.getClass ( ) ) . isEqualTo ( com.google.gerrit.server.query.change.AndChangeSource.class ) ; com.google.common.truth.Truth.assertThat ( out.getChildren ( ) ) . containsExactly ( query ( com.google.gerrit.index.query.Predicate.and ( in.getChild ( 0 ) , in.getChild ( 2 ) ) ) , in.getChild ( 1 ) ) . inOrder ( ) ; }
Source:
public com.google.gerrit.extensions.restapi.Response < ? > apply ( com.google.gerrit.server.change.ChangeResource rsrc , com.google.gerrit.server.change.Index.Input input ) throws com.google.gerrit.extensions.restapi.AuthException , java.io.IOException { com.google.gerrit.server.project.ChangeControl ctl = rsrc.getControl ( ) ; if ( ( ! ( ctl.isOwner ( ) ) ) && ( ! ( ctl.getCurrentUser ( ) . getCapabilities ( ) . canMaintainServer ( ) ) ) ) { throw new com.google.gerrit.extensions.restapi.AuthException ( "Only change owner or server maintainer can reindex" ) ; } indexer.index ( db.get ( ) , rsrc.getChange ( ) ) ; return com.google.gerrit.extensions.restapi.Response.none ( ) ; }

Target:
public com.google.gerrit.extensions.restapi.Response < ? > apply ( com.google.gerrit.server.change.ChangeResource rsrc , com.google.gerrit.server.change.Index.Input input ) throws com.google.gerrit.extensions.restapi.AuthException , java.io.IOException { com.google.gerrit.server.project.ChangeControl ctl = rsrc.getControl ( ) ; if ( ( ! ( ctl.isOwner ( ) ) ) && ( ! ( ctl.getUser ( ) . getCapabilities ( ) . canMaintainServer ( ) ) ) ) { throw new com.google.gerrit.extensions.restapi.AuthException ( "Only change owner or server maintainer can reindex" ) ; } indexer.index ( db.get ( ) , rsrc.getChange ( ) ) ; return com.google.gerrit.extensions.restapi.Response.none ( ) ; }
Source:
public void testSubscriptionWithoutServerSetting ( ) throws java.lang.Exception { org.eclipse.jgit.junit.TestRepository < ? > superRepo = createProjectWithPush ( "super-project" ) ; org.eclipse.jgit.junit.TestRepository < ? > subRepo = createProjectWithPush ( "subscribed-to-project" ) ; createSubmoduleSubscription ( superRepo , "master" , "subscribed-to-project" , "master" ) ; pushChangeTo ( subRepo , "master" ) ; com.google.common.truth.Truth.assertThat ( hasSubmodule ( superRepo , "master" , "subscribed-to-project" ) ) . isFalse ( ) ; }

Target:
public void testSubscriptionWithoutSpecificSubscription ( ) throws java.lang.Exception { org.eclipse.jgit.junit.TestRepository < ? > superRepo = createProjectWithPush ( "super-project" ) ; org.eclipse.jgit.junit.TestRepository < ? > subRepo = createProjectWithPush ( "subscribed-to-project" ) ; createSubmoduleSubscription ( superRepo , "master" , "subscribed-to-project" , "master" ) ; pushChangeTo ( subRepo , "master" ) ; com.google.common.truth.Truth.assertThat ( hasSubmodule ( superRepo , "master" , "subscribed-to-project" ) ) . isFalse ( ) ; }
Source:
public com.google.gerrit.server.change.ChangeEditResource parse ( com.google.gerrit.server.change.ChangeResource change , com.google.gerrit.extensions.restapi.IdString id ) { throw new java.lang.IllegalStateException ( "not yet implemented" ) ; }

Target:
public com.google.gerrit.server.change.ChangeEditResource parse ( com.google.gerrit.server.change.ChangeResource rsrc , com.google.gerrit.extensions.restapi.IdString id ) throws com.google.gerrit.extensions.restapi.AuthException , com.google.gerrit.extensions.restapi.ResourceNotFoundException , com.google.gerrit.server.project.InvalidChangeOperationException , java.io.IOException { com.google.common.base.Optional < com.google.gerrit.server.edit.ChangeEdit > edit = editUtil.byChange ( rsrc.getChange ( ) ) ; if ( ! ( edit.isPresent ( ) ) ) { throw new com.google.gerrit.extensions.restapi.ResourceNotFoundException ( id ) ; } return new com.google.gerrit.server.change.ChangeEditResource ( rsrc , edit.get ( ) , id.get ( ) ) ; }
Source:
public com.google.gerrit.server.change.ReviewerJson.ReviewerInfo format ( com.google.gerrit.server.change.ReviewerJson.ReviewerInfo out , com.google.gerrit.server.project.ChangeControl ctl ) throws com.google.gwtorm.server.OrmException { com.google.gerrit.reviewdb.client.PatchSet.Id psId = ctl.getChange ( ) . currentPatchSetId ( ) ; return format ( out , ctl , approvalsUtil.byPatchSetUser ( db.get ( ) , ctl , psId , new com.google.gerrit.reviewdb.client.Account.Id ( out._accountId ) ) ) ; }

Target:
public com.google.gerrit.extensions.api.changes.ReviewerInfo format ( com.google.gerrit.extensions.api.changes.ReviewerInfo out , com.google.gerrit.server.project.ChangeControl ctl ) throws com.google.gwtorm.server.OrmException { com.google.gerrit.reviewdb.client.PatchSet.Id psId = ctl.getChange ( ) . currentPatchSetId ( ) ; return format ( out , ctl , approvalsUtil.byPatchSetUser ( db.get ( ) , ctl , psId , new com.google.gerrit.reviewdb.client.Account.Id ( out._accountId ) ) ) ; }
Source:
public com.google.gerrit.acceptance.RestResponse putRaw ( java.lang.String endPoint , com.google.gerrit.extensions.restapi.RawInput stream ) throws java.io.IOException { com.google.common.base.Preconditions.checkNotNull ( stream ) ; org.apache.http.client.fluent.Request put = org.apache.http.client.fluent.Request.Put ( ( ( ( url ) + "/a" ) + endPoint ) ) ; put.addHeader ( new org.apache.http.message.BasicHeader ( "Content-Type" , stream.getContentType ( ) ) ) ; put.body ( new org.apache.http.entity.BufferedHttpEntity ( new org.apache.http.entity.InputStreamEntity ( stream.getInputStream ( ) , stream.getContentLength ( ) ) ) ) ; return execute ( put ) ; }

Target:
public com.google.gerrit.acceptance.RestResponse putRaw ( java.lang.String endPoint , com.google.gerrit.extensions.restapi.RawInput stream ) throws java.io.IOException { com.google.common.base.Preconditions.checkNotNull ( stream ) ; org.apache.http.client.fluent.Request put = org.apache.http.client.fluent.Request.Put ( getUrl ( endPoint ) ) ; put.addHeader ( new org.apache.http.message.BasicHeader ( "Content-Type" , stream.getContentType ( ) ) ) ; put.body ( new org.apache.http.entity.BufferedHttpEntity ( new org.apache.http.entity.InputStreamEntity ( stream.getInputStream ( ) , stream.getContentLength ( ) ) ) ) ; return execute ( put ) ; }
Source:
public com.google.gwtorm.server.ResultSet < com.google.gerrit.server.query.change.ChangeData > read ( ) throws com.google.gwtorm.server.OrmException { final com.google.gerrit.reviewdb.client.RevId id = new com.google.gerrit.reviewdb.client.RevId ( abbreviated ( ) . name ( ) ) ; if ( id.isComplete ( ) ) { return com.google.gerrit.server.query.change.ChangeDataResultSet.patchSet ( dbProvider.get ( ) . patchSets ( ) . byRevision ( id ) ) ; } else { return com.google.gerrit.server.query.change.ChangeDataResultSet.patchSet ( dbProvider.get ( ) . patchSets ( ) . byRevisionRange ( id , id.max ( ) ) ) ; } }

Target:
public com.google.gwtorm.server.ResultSet < com.google.gerrit.server.query.change.ChangeData > read ( ) throws com.google.gwtorm.server.OrmException { final com.google.gerrit.reviewdb.client.RevId id = new com.google.gerrit.reviewdb.client.RevId ( abbrevId.name ( ) ) ; if ( id.isComplete ( ) ) { return com.google.gerrit.server.query.change.ChangeDataResultSet.patchSet ( dbProvider.get ( ) . patchSets ( ) . byRevision ( id ) ) ; } else { return com.google.gerrit.server.query.change.ChangeDataResultSet.patchSet ( dbProvider.get ( ) . patchSets ( ) . byRevisionRange ( id , id.max ( ) ) ) ; } }
Source:
public com.google.gitiles.GitilesView.Builder setPathPart ( java.lang.String path ) { switch ( type ) { case PATH : case DIFF : com.google.common.base.Preconditions.checkState ( ( path != null ) , "cannot set null path on %s view" , type ) ; break ; case ARCHIVE : case DESCRIBE : case REFS : case LOG : break ; default : com.google.common.base.Preconditions.checkState ( ( path == null ) , "cannot set path on %s view" , type ) ; break ; } this . path = ( path != null ) ? com.google.gitiles.GitilesView.maybeTrimLeadingAndTrailingSlash ( path ) : null ; return this ; }

Target:
public com.google.gitiles.GitilesView.Builder setPathPart ( java.lang.String path ) { switch ( type ) { case PATH : case DIFF : com.google.common.base.Preconditions.checkState ( ( path != null ) , "cannot set null path on %s view" , type ) ; break ; case BLAME : case ARCHIVE : case DESCRIBE : case REFS : case LOG : break ; default : com.google.common.base.Preconditions.checkState ( ( path == null ) , "cannot set path on %s view" , type ) ; break ; } this . path = ( path != null ) ? com.google.gitiles.GitilesView.maybeTrimLeadingAndTrailingSlash ( path ) : null ; return this ; }
Source:
protected org.eclipse.jgit.junit.TestRepository < ? > createProjectWithPush ( java.lang.String name , @ com.google.gerrit.common.Nullable com.google.gerrit.reviewdb.client.Project.NameKey parent , boolean createEmptyCommit , com.google.gerrit.extensions.client.SubmitType submitType ) throws java.lang.Exception { com.google.gerrit.reviewdb.client.Project.NameKey project = createProject ( name , parent , createEmptyCommit , submitType ) ; HEAD ( 26 ) ; a551 ( "More horizontal space for patch set descriptions" ) ; grant ( Permission.PUSH , project , "refs/heads/*" ) ; grant ( Permission.SUBMIT , project , "refs/for/refs/heads/*" ) ; }

Target:
protected org.eclipse.jgit.junit.TestRepository < ? > createProjectWithPush ( java.lang.String name , @ com.google.gerrit.common.Nullable com.google.gerrit.reviewdb.client.Project.NameKey parent , boolean createEmptyCommit , com.google.gerrit.extensions.client.SubmitType submitType ) throws java.lang.Exception { com.google.gerrit.reviewdb.client.Project.NameKey project = createProject ( name , parent , createEmptyCommit , submitType ) ; grant ( Permission.PUSH , project , "refs/heads/*" ) ; grant ( Permission.SUBMIT , project , "refs/for/refs/heads/*" ) ; return cloneProject ( project ) ; }
Source:
private void createLuceneIndex ( ) throws java.io.IOException { com.google.inject.Injector injector = com.google.inject.Guice.createInjector ( new com.google.gerrit.lucene.LuceneIndexModule ( com.google.gerrit.server.index.ChangeSchemas.getLatest ( ) . getVersion ( ) , 0 , null ) , new com.google.gerrit.pgm.init.InitIndex.MockIndexSupportModule ( ) ) ; com.google.gerrit.server.index.ChangeIndex index = injector.getInstance ( com.google.gerrit.lucene.LuceneChangeIndex.class ) ; index.markReady ( true ) ; index.close ( ) ; }

Target:
public void run ( ) throws java.io.IOException { ui.header ( "Index" ) ; com.google.gerrit.server.index.IndexModule.IndexType type = index.select ( "Type" , "type" , IndexType.LUCENE ) ; if ( ( site.isNew ) && ( type == ( com.google.gerrit.server.index.IndexModule.IndexType.LUCENE ) ) ) { com.google.gerrit.lucene.LuceneChangeIndex.setReady ( site , com.google.gerrit.server.index.ChangeSchemas.getLatest ( ) . getVersion ( ) , true ) ; } else { ui.message ( ( "The index must be built before starting Gerrit:\n" + " java -jar gerrit.war reindex -d site_path\n" ) ) ; initFlags.autoStart = false ; } }
Source:
private void deleteDraftComment ( com.google.gerrit.reviewdb.client.PatchLineComment c ) throws com.google.gwtorm.server.OrmException { createDraftUpdateIfNull ( ) ; draftUpdate.deleteComment ( c ) ; }

Target:
public void putComment ( com.google.gerrit.reviewdb.client.PatchLineComment c ) { verifyComment ( c ) ; createDraftUpdateIfNull ( ) ; if ( ( c.getStatus ( ) ) == ( PatchLineComment.Status.DRAFT ) ) { draftUpdate.putComment ( c ) ; } else { comments.add ( c ) ; draftUpdate.deleteComment ( c ) ; } }
Source:
void display ( final java.lang.String token ) { assert token != null ; try { com.google.gerrit.client.Dispatcher.select ( token ) ; } catch ( java.lang.RuntimeException err ) { com.google.gwt.core.client.GWT.log ( ( "Error parsing history token: " + token ) , err ) ; com.google.gerrit.client.Gerrit.display ( token , new com.google.gerrit.client.NotFoundScreen ( ) ) ; } }

Target:
void display ( java.lang.String token ) { assert token != null ; try { try { if ( token.startsWith ( com.google.gerrit.client.Dispatcher.RELOAD_UI ) ) { com.google.gerrit.client.Dispatcher.wasStartedByReloadUI = true ; token = com.google.gerrit.client.Dispatcher.skip ( com.google.gerrit.client.Dispatcher.RELOAD_UI , token ) ; } com.google.gerrit.client.Dispatcher.select ( token ) ; } finally { com.google.gerrit.client.Dispatcher.wasStartedByReloadUI = false ; } } catch ( java.lang.RuntimeException err ) { com.google.gwt.core.client.GWT.log ( ( "Error parsing history token: " + token ) , err ) ; com.google.gerrit.client.Gerrit.display ( token , new com.google.gerrit.client.NotFoundScreen ( ) ) ; } }
Source:
protected void configureServlets ( ) { serve ( "/gitweb" ) . with ( com.google.gerrit.httpd.gitweb.GitWebServlet.class ) ; serve ( "/gitweb-logo.png" ) . with ( com.google.gerrit.httpd.gitweb.GitLogoServlet.class ) ; serve ( "/gitweb-default.css" ) . with ( GitWebCssServlet.Default.class ) ; serve ( "/gitweb-site.css" ) . with ( GitWebCssServlet.Site.class ) ; }

Target:
protected void configureServlets ( ) { serve ( "/gitweb" ) . with ( com.google.gerrit.httpd.gitweb.GitWebServlet.class ) ; serve ( "/gitweb-logo.png" ) . with ( com.google.gerrit.httpd.gitweb.GitLogoServlet.class ) ; serve ( "/gitweb.js" ) . with ( com.google.gerrit.httpd.gitweb.GitWebJavaScriptServlet.class ) ; serve ( "/gitweb-default.css" ) . with ( GitWebCssServlet.Default.class ) ; serve ( "/gitweb-site.css" ) . with ( GitWebCssServlet.Site.class ) ; }
Source:
public com.google.gerrit.extensions.api.projects.CommitApi commit ( java.lang.String commit ) throws com.google.gerrit.extensions.restapi.RestApiException { try { return commitApi.create ( commitsCollection.parse ( checkExists ( ) , com.google.gerrit.extensions.restapi.IdString.fromDecoded ( commit ) ) ) ; } catch ( java.io.IOException e ) { throw new com.google.gerrit.extensions.restapi.RestApiException ( "Cannot parse commit" , e ) ; } }

Target:
public com.google.gerrit.extensions.api.projects.CommitApi commit ( java.lang.String commit ) throws com.google.gerrit.extensions.restapi.RestApiException { try { return commitApi.create ( commitsCollection.parse ( checkExists ( ) , com.google.gerrit.extensions.restapi.IdString.fromDecoded ( commit ) ) ) ; } catch ( java.lang.Exception e ) { throw com.google.gerrit.server.api.ApiUtil.asRestApiException ( "Cannot parse commit" , e ) ; } }
Source:
public java.lang.String getRequestURI ( ) { return null ; }

Target:
public java.lang.String getRequestURI ( ) { java.lang.String uri = ( ( contextPath ) + ( servletPath ) ) + ( path ) ; if ( ! ( parameters.isEmpty ( ) ) ) { uri += "?" + ( com.google.gitiles.GitilesView.paramsToString ( parameters ) ) ; } return uri ; }
Source:
private com.google.gerrit.server.account.AuthResult byUserName ( final javax.servlet.http.HttpServletResponse rsp , final java.lang.String userName ) { try { final com.google.gerrit.reviewdb.ReviewDb db = schema.open ( ) ; try { com.google.gerrit.reviewdb.AccountExternalId.Key key = new com.google.gerrit.reviewdb.AccountExternalId.Key ( com.google.gerrit.reviewdb.AccountExternalId.SCHEME_USERNAME , userName ) ; return auth ( db.accountExternalIds ( ) . get ( key ) ) ; } finally { db.close ( ) ; } } catch ( com.google.gwtorm.client.OrmException e ) { getServletContext ( ) . log ( "cannot query database" , e ) ; return null ; } }

Target:
private com.google.gerrit.server.account.AuthResult byUserName ( final javax.servlet.http.HttpServletResponse rsp , final java.lang.String userName ) { try { final com.google.gerrit.reviewdb.ReviewDb db = schema.open ( ) ; try { com.google.gerrit.reviewdb.AccountExternalId.Key key = new com.google.gerrit.reviewdb.AccountExternalId.Key ( com.google.gerrit.reviewdb.AccountExternalId.SCHEME_USERNAME , userName ) ; return auth ( accountExternalIdCache.get ( key ) ) ; } finally { db.close ( ) ; } } catch ( com.google.gwtorm.client.OrmException e ) { getServletContext ( ) . log ( "cannot query database" , e ) ; return null ; } }
Source:
HEAD ( ) { }

Target:
public org.apache.sshd.server.CommandFactory get ( ) { return new org.apache.sshd.server.CommandFactory ( ) { @ java.lang.Override public org.apache.sshd.server.Command createCommand ( java.lang.String requestCommand ) { java.lang.String c = requestCommand ; com.google.gerrit.sshd.SshCreateCommandInterceptor interceptor = createCommandInterceptor.get ( ) ; if ( interceptor != null ) { c = interceptor.intercept ( c ) ; } return new com.google.gerrit.sshd.CommandFactoryProvider.Trampoline ( c ) ; } } ; }
Source:
private org.apache.lucene.search.Query fullTextQuery ( com.google.gerrit.server.index.IndexPredicate < com.google.gerrit.server.query.change.ChangeData > p ) throws com.google.gerrit.server.query.QueryParseException { java.lang.String value = p.getValue ( ) ; if ( value == null ) { throw new com.google.gerrit.server.query.QueryParseException ( "Full-text search over empty string not supported" ) ; } return queryBuilder.createPhraseQuery ( p.getField ( ) . getName ( ) , value ) ; }

Target:
private org.apache.lucene.search.Query fullTextQuery ( com.google.gerrit.server.index.IndexPredicate < com.google.gerrit.server.query.change.ChangeData > p ) throws com.google.gerrit.server.query.QueryParseException { java.lang.String value = p.getValue ( ) ; if ( value == null ) { throw new com.google.gerrit.server.query.QueryParseException ( "Full-text search over empty string not supported" ) ; } org.apache.lucene.search.Query query = queryBuilder.createPhraseQuery ( p.getField ( ) . getName ( ) , value ) ; if ( query == null ) { throw new com.google.gerrit.server.query.QueryParseException ( ( "Cannot create full-text query with value: " + value ) ) ; } return query ; }
Source:
public void getMultiple ( ) throws java.lang.Exception { com.google.gerrit.gpg.testutil.TestKey key1 = com.google.gerrit.gpg.testutil.TestKeys.validKeyWithoutExpiration ( ) ; com.google.gerrit.gpg.testutil.TestKey key2 = com.google.gerrit.gpg.testutil.TestKeys.validKeyWithExpiration ( ) ; tr.branch ( com.google.gerrit.gpg.PublicKeyStore.REFS_GPG_KEYS ) . commit ( ) . add ( com.google.gerrit.gpg.PublicKeyStore.keyObjectId ( key1.getKeyId ( ) ) . name ( ) , ( ( key1.getPublicKeyArmored ( ) ) + ( key2.getPublicKeyArmored ( ) ) ) ) . create ( ) ; assertKeys ( key1.getKeyId ( ) , key1 , key2 ) ; }

Target:
public void getMultiple ( ) throws java.lang.Exception { com.google.gerrit.gpg.testing.TestKey key1 = com.google.gerrit.gpg.testing.TestKeys.validKeyWithoutExpiration ( ) ; com.google.gerrit.gpg.testing.TestKey key2 = com.google.gerrit.gpg.testing.TestKeys.validKeyWithExpiration ( ) ; tr.branch ( com.google.gerrit.gpg.PublicKeyStore.REFS_GPG_KEYS ) . commit ( ) . add ( com.google.gerrit.gpg.PublicKeyStore.keyObjectId ( key1.getKeyId ( ) ) . name ( ) , ( ( key1.getPublicKeyArmored ( ) ) + ( key2.getPublicKeyArmored ( ) ) ) ) . create ( ) ; assertKeys ( key1.getKeyId ( ) , key1 , key2 ) ; }
Source:
public void testUpsertOneExisting ( ) throws com.google.gwtorm.client.OrmException , java.sql.SQLException { stubExecuteBatchOK ( com.google.gwtorm.jdbc.TestJdbcAccess.UPDATE , 1 ) ; createClassUnderTest ( ) . upsert ( com.google.gwtorm.jdbc.TestJdbcAccess.ONE_ROW ) ; }

Target:
public void testUpsertOneExisting ( ) throws com.google.gwtorm.server.OrmException , java.sql.SQLException { java.sql.PreparedStatement update = stubStatementWithUpdateCounts ( com.google.gwtorm.jdbc.TestJdbcAccess.UPDATE , 1 ) ; java.sql.PreparedStatement insert = stubStatementWithUpdateCounts ( com.google.gwtorm.jdbc.TestJdbcAccess.INSERT ) ; createClassUnderTest ( ) . upsert ( oneRow ) ; com.google.gwtorm.jdbc.TestJdbcAccess.assertUsedBatchingOnly ( update ) ; com.google.gwtorm.jdbc.TestJdbcAccess.assertNotUsed ( insert ) ; }
Source:
private void onFailure ( java.lang.Throwable caught ) { if ( failed ) { return ; } failed = true ; for ( java.lang.Object o : callbacks ) { if ( o instanceof com.google.gwt.user.client.rpc.AsyncCallback ) { @ java.lang.SuppressWarnings ( value = "unchecked" ) com.google.gwt.user.client.rpc.AsyncCallback < java.lang.Object > cb = ( ( com.google.gwt.user.client.rpc.AsyncCallback < java.lang.Object > ) ( o ) ) ; cb.onFailure ( caught ) ; } else { @ java.lang.SuppressWarnings ( value = "unchecked" ) com.google.gwtjsonrpc.common.AsyncCallback < java.lang.Object > cb = ( ( com.google.gwtjsonrpc.common.AsyncCallback < java.lang.Object > ) ( o ) ) ; cb.onFailure ( caught ) ; } } }

Target:
public void onFailure ( java.lang.Throwable caught ) { if ( failed ) { return ; } failed = true ; failedThrowable = caught ; for ( com.google.gerrit.client.rpc.CallbackGroup.CallbackImpl < ? > cb : callbacks ) { cb.delegate.onFailure ( failedThrowable ) ; cb.delegate = null ; cb.result = null ; } callbacks.clear ( ) ; remaining.clear ( ) ; }
Source:
public void testPersonByNameRange_OrderByName ( ) throws java.lang.Exception { com.google.gwtorm.nosql.IndexFunction < com.google.gwtorm.data.TestPerson > idx = index ( "nameSuggest" , "WHERE name >= ? AND name <= ? ORDER BY name" ) ; com.google.gwtorm.nosql.IndexFunctionTest.assertEquals ( "nameSuggest" , idx.getName ( ) ) ; com.google.gwtorm.nosql.IndexKeyBuilder b ; com.google.gwtorm.data.TestPerson p ; b = new com.google.gwtorm.nosql.IndexKeyBuilder ( ) ; p = new com.google.gwtorm.data.TestPerson ( new com.google.gwtorm.data.TestPerson.Key ( "q" ) , 42 ) ; assertTrue ( idx.includes ( p ) ) ; idx.encode ( b , p ) ; com.google.gwtorm.nosql.IndexFunctionTest.assertEquals ( new byte [ ] { 'q' } , b ) ; }

Target:
public void testPersonByNameRange_OrderByName ( ) throws java.lang.Exception { com.google.gwtorm.nosql.IndexFunction < com.google.gwtorm.data.Person > idx = index ( "nameSuggest" , "WHERE name >= ? AND name <= ? ORDER BY name" ) ; org.junit.Assert.assertEquals ( "nameSuggest" , idx.getName ( ) ) ; com.google.gwtorm.nosql.IndexKeyBuilder b ; com.google.gwtorm.data.Person p ; b = new com.google.gwtorm.nosql.IndexKeyBuilder ( ) ; p = new com.google.gwtorm.data.Person ( new com.google.gwtorm.data.Person.Key ( "q" ) , 42 ) ; org.junit.Assert.assertTrue ( idx.includes ( p ) ) ; idx.encode ( b , p ) ; com.google.gwtorm.nosql.IndexFunctionTest.assertEqualToBuilderResult ( new byte [ ] { 'q' } , b ) ; }
Source:
public void testInheritRead_SingleBranchDoesNotOverrideInherited ( ) { grant ( parent , com.google.gerrit.common.data.Permission.READ , registered , "refs/*" ) ; grant ( parent , com.google.gerrit.common.data.Permission.PUSH , registered , "refs/for/refs/*" ) ; grant ( local , com.google.gerrit.common.data.Permission.READ , registered , "refs/heads/foobar" ) ; com.google.gerrit.server.project.ProjectControl u = user ( ) ; assertTrue ( "can upload" , u.canPushToAtLeastOneRef ( ) ) ; assertTrue ( "can upload refs/heads/master" , u.controlForRef ( "refs/heads/master" ) . canUpload ( ) ) ; assertTrue ( "can upload refs/heads/foobar" , u.controlForRef ( "refs/heads/foobar" ) . canUpload ( ) ) ; }

Target:
public void testInheritRead_SingleBranchDoesNotOverrideInherited ( ) { grant ( parent , com.google.gerrit.common.data.Permission.READ , registered , "refs/*" ) ; grant ( parent , com.google.gerrit.common.data.Permission.PUSH , registered , "refs/for/refs/*" ) ; grant ( local , com.google.gerrit.common.data.Permission.READ , registered , "refs/heads/foobar" ) ; com.google.gerrit.server.project.ProjectControl u = user ( ) ; assertTrue ( "can upload" , ( ( u.canPushToAtLeastOneRef ( ) ) == ( com.google.gerrit.common.data.Capable.OK ) ) ) ; assertTrue ( "can upload refs/heads/master" , u.controlForRef ( "refs/heads/master" ) . canUpload ( ) ) ; assertTrue ( "can upload refs/heads/foobar" , u.controlForRef ( "refs/heads/foobar" ) . canUpload ( ) ) ; }
Source:
byte [ ] build ( com.google.gerrit.server.notedb.CommentsInNotesUtil commentsUtil ) { return commentsUtil.buildNote ( com.google.gerrit.server.PatchLineCommentsUtil.PLC_ORDER.sortedCopy ( comments.values ( ) ) ) ; }

Target:
byte [ ] build ( com.google.gerrit.server.notedb.CommentsInNotesUtil commentsUtil ) { java.io.ByteArrayOutputStream out = new java.io.ByteArrayOutputStream ( ) ; if ( ( pushCert ) != null ) { byte [ ] certBytes = pushCert.getBytes ( java.nio.charset.StandardCharsets.UTF_8 ) ; out.write ( certBytes , 0 , com.google.gerrit.server.notedb.RevisionNoteBuilder.trimTrailingNewlines ( certBytes ) ) ; out.write ( '\n' ) ; } commentsUtil.buildNote ( com.google.gerrit.server.PatchLineCommentsUtil.PLC_ORDER.sortedCopy ( comments.values ( ) ) , out ) ; return out.toByteArray ( ) ; }
Source:
public void testCUSTOM_NoFullNameUser ( ) { setFrom ( "A ${user} B <my.server@email.address>" ) ; final java.lang.String email = "a.u.thor@test.example.com" ; final com.google.gerrit.reviewdb.client.Account.Id user = user ( null , email ) ; org.easymock.EasyMock.replay ( accountCache ) ; final com.google.gerrit.server.mail.Address r = create ( ) . from ( user ) ; assertNotNull ( r ) ; assertEquals ( "A Anonymous Coward B" , r.name ) ; assertEquals ( "my.server@email.address" , r.email ) ; org.easymock.EasyMock.verify ( accountCache ) ; }

Target:
public void testCUSTOM_NoFullNameUser ( ) { setFrom ( "A ${user} B <my.server@email.address>" ) ; final java.lang.String email = "a.u.thor@test.example.com" ; final com.google.gerrit.reviewdb.client.Account.Id user = user ( null , email ) ; org.easymock.EasyMock.replay ( accountCache ) ; final com.google.gerrit.server.mail.Address r = create ( ) . from ( user ) ; org.junit.Assert.assertNotNull ( r ) ; org.junit.Assert.assertEquals ( "A Anonymous Coward B" , r.name ) ; org.junit.Assert.assertEquals ( "my.server@email.address" , r.email ) ; org.easymock.EasyMock.verify ( accountCache ) ; }
Source:
public void replace ( byte [ ] key , byte [ ] data ) throws com.google.gwtorm.client.OrmException { upsert ( key , data ) ; }

Target:
public void insert ( byte [ ] key , final byte [ ] newData ) throws com.google.gwtorm.client.OrmDuplicateKeyException , com.google.gwtorm.client.OrmException { try { atomicUpdate ( key , new com.google.gwtorm.client.AtomicUpdate < byte [ ] > ( ) { @ java.lang.Override public byte [ ] update ( byte [ ] oldData ) { if ( oldData != null ) { throw new com.google.gwtorm.nosql.generic.GenericSchema.KeyExists ( ) ; } return newData ; } } ) ; } catch ( com.google.gwtorm.nosql.generic.GenericSchema.KeyExists err ) { throw new com.google.gwtorm.client.OrmDuplicateKeyException ( "Duplicate key" ) ; } }
Source:
private static void assertUsedBatchingOnly ( java.sql.PreparedStatement statement ) throws java.sql.SQLException { org.mockito.Mockito.verify ( statement , org.mockito.Mockito.atLeastOnce ( ) ) . addBatch ( ) ; org.mockito.Mockito.verify ( statement ) . executeBatch ( ) ; org.mockito.Mockito.verify ( statement , org.mockito.Mockito.never ( ) ) . executeUpdate ( ) ; }

Target:
protected static void assertUsedBatchingOnly ( java.sql.PreparedStatement ps , int ... ids ) throws java.sql.SQLException { org.mockito.Mockito.verify ( ps , org.mockito.Mockito.times ( ids.length ) ) . addBatch ( ) ; org.mockito.Mockito.verify ( ps ) . executeBatch ( ) ; org.mockito.Mockito.verify ( ps , org.mockito.Mockito.never ( ) ) . executeUpdate ( ) ; com.google.gwtorm.jdbc.AbstractTestJdbcAccess.assertExpectedIdsUsed ( ps , ids ) ; }
Source:
public void insert ( com.google.gerrit.server.query.change.ChangeData cd ) throws java.io.IOException { org.apache.lucene.index.Term id = idTerm ( cd ) ; org.apache.lucene.document.Document doc = toDocument ( cd ) ; if ( cd.getChange ( ) . getStatus ( ) . isOpen ( ) ) { closedIndex.delete ( id ) ; openIndex.insert ( doc ) ; } else { openIndex.delete ( id ) ; closedIndex.insert ( doc ) ; } }

Target:
public com.google.common.util.concurrent.ListenableFuture < java.lang.Void > insert ( com.google.gerrit.server.query.change.ChangeData cd ) throws java.io.IOException { org.apache.lucene.index.Term id = com.google.gerrit.lucene.QueryBuilder.idTerm ( cd ) ; org.apache.lucene.document.Document doc = toDocument ( cd ) ; if ( cd.getChange ( ) . getStatus ( ) . isOpen ( ) ) { return com.google.gerrit.lucene.LuceneChangeIndex.allOf ( closedIndex.delete ( id ) , openIndex.insert ( doc ) ) ; } else { return com.google.gerrit.lucene.LuceneChangeIndex.allOf ( openIndex.delete ( id ) , closedIndex.insert ( doc ) ) ; } }
Source:
private java.util.HashMap < java.util.regex.Pattern , com.googlesource.gerrit.plugins.hooks.validation.ItsAssociationPolicy > getCommentRegexMap ( ) { java.util.HashMap < java.util.regex.Pattern , com.googlesource.gerrit.plugins.hooks.validation.ItsAssociationPolicy > regexMap = new java.util.HashMap < java.util.regex.Pattern , com.googlesource.gerrit.plugins.hooks.validation.ItsAssociationPolicy > ( ) ; java.util.regex.Pattern pattern = issueExtractor.getPattern ( ) ; if ( pattern != null ) { regexMap.put ( pattern , gerritConfig.getEnum ( "commentLink" , itsName , "association" , ItsAssociationPolicy.OPTIONAL ) ) ; } return regexMap ; }

Target:
private com.googlesource.gerrit.plugins.hooks.validation.ItsAssociationPolicy getItsAssociationPolicy ( ) { return gerritConfig.getEnum ( "commentLink" , itsName , "association" , ItsAssociationPolicy.OPTIONAL ) ; }
Source:
public void setSshInjector ( com.google.inject.Injector injector ) { sshModule = com.google.gerrit.server.plugins.PluginGuiceEnvironment.copy ( injector ) ; sshGen = injector.getProvider ( com.google.gerrit.server.plugins.ModuleGenerator.class ) ; sshSets = com.google.gerrit.server.plugins.PluginGuiceEnvironment.dynamicSetsOf ( injector ) ; sshMaps = com.google.gerrit.server.plugins.PluginGuiceEnvironment.dynamicMapsOf ( injector ) ; onStart.addAll ( com.google.gerrit.server.plugins.PluginGuiceEnvironment.listeners ( injector , com.google.gerrit.server.plugins.StartPluginListener.class ) ) ; onReload.addAll ( com.google.gerrit.server.plugins.PluginGuiceEnvironment.listeners ( injector , com.google.gerrit.server.plugins.ReloadPluginListener.class ) ) ; }

Target:
public void setSshInjector ( com.google.inject.Injector injector ) { sshModule = com.google.gerrit.server.plugins.PluginGuiceEnvironment.copy ( injector ) ; sshGen = injector.getProvider ( com.google.gerrit.server.plugins.ModuleGenerator.class ) ; sshSets = com.google.gerrit.extensions.registration.PrivateInternals_DynamicTypes.dynamicSetsOf ( injector ) ; sshMaps = com.google.gerrit.extensions.registration.PrivateInternals_DynamicTypes.dynamicMapsOf ( injector ) ; onStart.addAll ( com.google.gerrit.server.plugins.PluginGuiceEnvironment.listeners ( injector , com.google.gerrit.server.plugins.StartPluginListener.class ) ) ; onReload.addAll ( com.google.gerrit.server.plugins.PluginGuiceEnvironment.listeners ( injector , com.google.gerrit.server.plugins.ReloadPluginListener.class ) ) ; }
Source:
protected void delegateTo ( final org.apache.sshd.server.CommandFactory.Command cmd ) throws java.io.IOException { if ( cmd instanceof org.apache.sshd.server.CommandFactory.SessionAware ) { ( ( org.apache.sshd.server.CommandFactory.SessionAware ) ( cmd ) ) . setSession ( session ) ; } cmd.setInputStream ( in ) ; cmd.setOutputStream ( out ) ; cmd.setErrorStream ( err ) ; cmd.setExitCallback ( exit ) ; cmd.start ( ) ; }

Target:
protected void provideStateTo ( final org.apache.sshd.server.CommandFactory.Command cmd ) { if ( cmd instanceof org.apache.sshd.server.CommandFactory.SessionAware ) { ( ( org.apache.sshd.server.CommandFactory.SessionAware ) ( cmd ) ) . setSession ( session ) ; } cmd.setInputStream ( in ) ; cmd.setOutputStream ( out ) ; cmd.setErrorStream ( err ) ; cmd.setExitCallback ( exit ) ; }
Source:
public void generatesExpectedMessage ( ) throws java.lang.Exception { com.cisco.gerrit.plugins.slack.config.ProjectConfig config = getConfig ( ) ; mockEvent.change = com.google.common.base.Suppliers.ofInstance ( mockChange ) ; mockEvent.reviewer = com.google.common.base.Suppliers.ofInstance ( mockAccount ) ; mockChange.project = "testproject" ; mockChange.branch = "master" ; mockChange.commitMessage = "This is the first line\nAnd the second line." ; mockChange.url = "https://change/" ; mockAccount.name = "Unit Tester" ; com.cisco.gerrit.plugins.slack.message.MessageGenerator messageGenerator ; messageGenerator = com.cisco.gerrit.plugins.slack.message.MessageGeneratorFactory.newInstance ( mockEvent , config ) ; java.lang.String expectedResult ; expectedResult = "{\"text\": \"Unit Tester was added to review\\n>>>" + ( ( "testproject (master): This is the first line" + " (https://change/)\",\"channel\": \"#testchannel\"," ) + "\"username\": \"testuser\"}\n" ) ; java.lang.String actualResult ; actualResult = messageGenerator.generate ( ) ; org.junit.Assert.assertThat ( actualResult , org.hamcrest.core.Is.is ( org.hamcrest.CoreMatchers.equalTo ( expectedResult ) ) ) ; }

Target:
public void generatesExpectedMessage ( ) throws java.lang.Exception { com.cisco.gerrit.plugins.slack.config.ProjectConfig config = getConfig ( ) ; mockEvent.change = com.google.common.base.Suppliers.ofInstance ( mockChange ) ; mockEvent.reviewer = com.google.common.base.Suppliers.ofInstance ( mockAccount ) ; mockChange.number = 1234 ; mockChange.project = "testproject" ; mockChange.branch = "master" ; mockChange.commitMessage = "This is the first line\nAnd the second line." ; mockChange.url = "https://change/" ; mockAccount.name = "Unit Tester" ; com.cisco.gerrit.plugins.slack.message.MessageGenerator messageGenerator ; messageGenerator = com.cisco.gerrit.plugins.slack.message.MessageGeneratorFactory.newInstance ( mockEvent , config ) ; java.lang.String expectedResult ; expectedResult = "{\n" + ( ( ( ( ( ( ( ( ( ( ( " \"channel\": \"#testchannel\",\n" + " \"attachments\": [\n" ) + " {\n" ) + " \"fallback\": \"Unit Tester was added to review - testproject (master) - change 1234 - https://change/\",\n" ) + " \"pretext\": \"Unit Tester was added to review\",\n" ) + " \"title\": \"testproject (master) - change 1234\",\n" ) + " \"title_link\": \"https://change/\",\n" ) + " \"text\": \"This is the first line\",\n" ) + " \"color\": \"good\"\n" ) + " }\n" ) + " ]\n" ) + "}\n" ) ; java.lang.String actualResult ; actualResult = messageGenerator.generate ( ) ; org.junit.Assert.assertThat ( actualResult , org.hamcrest.core.Is.is ( org.hamcrest.CoreMatchers.equalTo ( expectedResult ) ) ) ; }
Source:
public void onSuccess ( final com.google.gerrit.common.data.PatchSetDetail result ) { ensureLoaded ( result ) ; patchTable.setRegisterKeys ( true ) ; }

Target:
public void loadPatchTable ( final com.google.gerrit.common.data.PatchSetDetail detail ) { if ( ! ( patchSet.getId ( ) . equals ( diffBaseId ) ) ) { patchTable = new com.google.gerrit.client.changes.PatchTable ( ) ; patchTable.setSavePointerId ( ( "PatchTable " + ( patchSet.getId ( ) ) ) ) ; patchTable.display ( diffBaseId , detail ) ; for ( com.google.gwt.event.dom.client.ClickHandler clickHandler : registeredClickHandler ) { patchTable.addClickHandler ( clickHandler ) ; } patchTable.setRegisterKeys ( true ) ; setActive ( true ) ; body.add ( patchTable ) ; } }
Source:
private static com.google.gerrit.server.git.CodeReviewCommit failed ( final org.eclipse.jgit.revwalk.RevWalk rw , final org.eclipse.jgit.revwalk.RevFlag canMergeFlag , final com.google.gerrit.server.git.CodeReviewCommit mergeTip , final com.google.gerrit.server.git.CodeReviewCommit n , final com.google.gerrit.server.git.CommitMergeStatus failure ) throws java.io.IOException , org.eclipse.jgit.errors.IncorrectObjectTypeException , org.eclipse.jgit.errors.MissingObjectException { rw.resetRetain ( canMergeFlag ) ; rw.markStart ( n ) ; rw.markUninteresting ( mergeTip ) ; com.google.gerrit.server.git.CodeReviewCommit failed ; while ( ( failed = ( ( com.google.gerrit.server.git.CodeReviewCommit ) ( rw.next ( ) ) ) ) != null ) { failed.setStatusCode ( failure ) ; } return failed ; }

Target:
private static com.google.gerrit.server.git.CodeReviewCommit failed ( com.google.gerrit.server.git.CodeReviewCommit.CodeReviewRevWalk rw , org.eclipse.jgit.revwalk.RevFlag canMergeFlag , com.google.gerrit.server.git.CodeReviewCommit mergeTip , com.google.gerrit.server.git.CodeReviewCommit n , com.google.gerrit.server.git.CommitMergeStatus failure ) throws java.io.IOException , org.eclipse.jgit.errors.IncorrectObjectTypeException , org.eclipse.jgit.errors.MissingObjectException { rw.resetRetain ( canMergeFlag ) ; rw.markStart ( n ) ; rw.markUninteresting ( mergeTip ) ; com.google.gerrit.server.git.CodeReviewCommit failed ; while ( ( failed = rw.next ( ) ) != null ) { failed.setStatusCode ( failure ) ; } return failed ; }
Source:
public int compare ( com.google.gerrit.server.notedb.ChangeRebuilderImpl.Event a , com.google.gerrit.server.notedb.ChangeRebuilderImpl.Event b ) { return com.google.common.collect.ComparisonChain.start ( ) . compareTrueFirst ( a.predatesChange , b.predatesChange ) . compare ( a.when , b.when ) . compare ( a.who , b.who , com.google.gerrit.reviewdb.server.ReviewDbUtil.intKeyOrdering ( ) ) . compare ( a.psId , b.psId , com.google.gerrit.reviewdb.server.ReviewDbUtil.intKeyOrdering ( ) . nullsLast ( ) ) . result ( ) ; }

Target:
public int compare ( com.google.gerrit.server.notedb.ChangeRebuilderImpl.Event a , com.google.gerrit.server.notedb.ChangeRebuilderImpl.Event b ) { return com.google.common.collect.ComparisonChain.start ( ) . compare ( a.when , b.when ) . compareTrueFirst ( isPatchSet ( a ) , isPatchSet ( b ) ) . compareTrueFirst ( a.predatesChange , b.predatesChange ) . compare ( a.who , b.who , com.google.gerrit.reviewdb.server.ReviewDbUtil.intKeyOrdering ( ) ) . compare ( a.psId , b.psId , com.google.gerrit.reviewdb.server.ReviewDbUtil.intKeyOrdering ( ) . nullsLast ( ) ) . result ( ) ; }
Source:
protected void configure ( ) { bind ( java.lang.String.class ) . annotatedWith ( com.googlesource.gerrit.plugins.hooks.its.ItsName.class ) . toInstance ( "ItsTestName" ) ; serverConfig = createMock ( org.eclipse.jgit.lib.Config.class ) ; bind ( org.eclipse.jgit.lib.Config.class ) . annotatedWith ( com.google.gerrit.server.config.GerritServerConfig.class ) . toInstance ( serverConfig ) ; commitMessageFetcher = createMock ( com.googlesource.gerrit.plugins.hooks.util.CommitMessageFetcher.class ) ; bind ( com.googlesource.gerrit.plugins.hooks.util.CommitMessageFetcher.class ) . toInstance ( commitMessageFetcher ) ; }

Target:
protected void configure ( ) { bind ( java.lang.String.class ) . annotatedWith ( com.googlesource.gerrit.plugins.hooks.its.ItsName.class ) . toInstance ( "ItsTestName" ) ; serverConfig = createMock ( org.eclipse.jgit.lib.Config.class ) ; bind ( org.eclipse.jgit.lib.Config.class ) . annotatedWith ( com.google.gerrit.server.config.GerritServerConfig.class ) . toInstance ( serverConfig ) ; commitMessageFetcher = createMock ( com.googlesource.gerrit.plugins.hooks.util.CommitMessageFetcher.class ) ; bind ( com.googlesource.gerrit.plugins.hooks.util.CommitMessageFetcher.class ) . toInstance ( commitMessageFetcher ) ; db = createMock ( com.google.gerrit.reviewdb.server.ReviewDb.class ) ; bind ( com.google.gerrit.reviewdb.server.ReviewDb.class ) . toInstance ( db ) ; }
Source:
private void assertIncludes ( java.util.List < com.google.gerrit.extensions.common.GroupInfo > includes , java.lang.String ... names ) { java.lang.Iterable < java.lang.String > includeNames = com.google.common.collect.Iterables.transform ( includes , new com.google.common.base.Function < com.google.gerrit.extensions.common.GroupInfo , java.lang.String > ( ) { @ java.lang.Override public java.lang.String apply ( @ com.google.gerrit.common.Nullable com.google.gerrit.extensions.common.GroupInfo info ) { return info.name ; } } ) ; com.google.common.truth.Truth.assertThat ( includeNames ) . containsExactlyElementsIn ( java.util.Arrays.asList ( names ) ) . inOrder ( ) ; }

Target:
private static void assertIncludes ( java.lang.Iterable < com.google.gerrit.extensions.common.GroupInfo > includes , java.lang.String ... expectedNames ) { java.lang.Iterable < java.lang.String > includeNames = com.google.common.collect.Iterables.transform ( includes , new com.google.common.base.Function < com.google.gerrit.extensions.common.GroupInfo , java.lang.String > ( ) { @ java.lang.Override public java.lang.String apply ( @ com.google.gerrit.common.Nullable com.google.gerrit.extensions.common.GroupInfo info ) { return info.name ; } } ) ; com.google.common.truth.Truth.assertThat ( includeNames ) . containsExactlyElementsIn ( java.util.Arrays.asList ( expectedNames ) ) . inOrder ( ) ; }
Source:
public java.lang.String toString ( ) { return com.google.common.base.MoreObjects.toStringHelper ( this ) . addValue ( getId ( ) ) . toString ( ) ; }

Target:
public java.lang.String toString ( ) { com.google.common.base.MoreObjects.ToStringHelper h = com.google.common.base.MoreObjects.toStringHelper ( this ) ; if ( ( change ) != null ) { h.addValue ( change ) ; } else { h.addValue ( legacyId ) ; } return h.toString ( ) ; }
Source:
private static java.util.List < java.lang.String > splitProjection ( java.lang.String projection ) { return com.google.common.collect.Lists.newArrayList ( com.google.common.base.Splitter.on ( '~' ) . limit ( 2 ) . split ( projection ) ) ; }

Target:
private static java.util.List < java.lang.String > splitProjection ( com.google.gerrit.extensions.restapi.IdString projection ) { java.util.List < java.lang.String > p = com.google.common.collect.Lists.newArrayListWithCapacity ( 2 ) ; com.google.common.collect.Iterables.addAll ( p , com.google.common.base.Splitter.on ( '~' ) . limit ( 2 ) . split ( projection.get ( ) ) ) ; return p ; }
Source:
protected java.util.SortedSet < java.lang.String > cacheNames ( ) { java.util.SortedSet < java.lang.String > names = com.google.common.collect.Sets.newTreeSet ( ) ; for ( java.lang.String plugin : cacheMap.plugins ( ) ) { for ( java.lang.String name : cacheMap.byPlugin ( plugin ) . keySet ( ) ) { names.add ( cacheNameOf ( plugin , name ) ) ; } } return names ; }

Target:
protected java.util.SortedSet < java.lang.String > cacheNames ( ) { java.util.SortedSet < java.lang.String > names = com.google.common.collect.Sets.newTreeSet ( ) ; for ( com.google.gerrit.extensions.registration.DynamicMap.Entry < com.google.common.cache.Cache < ? , ? > > e : cacheMap ) { names.add ( cacheNameOf ( e.getPluginName ( ) , e.getExportName ( ) ) ) ; } return names ; }
Source:
public void subsetOfBranchesVisibleIncludingHead ( ) throws java.lang.Exception { allow ( Permission.READ , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS , "refs/heads/master" ) ; deny ( Permission.READ , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS , "refs/heads/branch" ) ; assertRefs ( "HEAD" , ( ( r1 ) + "1" ) , ( ( r1 ) + "meta" ) , "refs/heads/master" , "refs/tags/master-tag" ) ; }

Target:
public void subsetOfBranchesVisibleIncludingHead ( ) throws java.lang.Exception { allow ( Permission.READ , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS , "refs/heads/master" ) ; deny ( Permission.READ , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS , "refs/heads/branch" ) ; setApiUser ( user ) ; assertRefs ( "HEAD" , ( ( r1 ) + "1" ) , ( ( r1 ) + "meta" ) , "refs/heads/master" , "refs/tags/master-tag" ) ; }
Source:
private int getCodeMirrorHeight ( ) { int rest = ( ( ( com.google.gerrit.client.Gerrit.getHeaderFooterHeight ( ) ) + ( header.getOffsetHeight ( ) ) ) + ( diffTable.getHeaderHeight ( ) ) ) + 5 ; return ( com.google.gwt.user.client.Window.getClientHeight ( ) ) - rest ; }

Target:
void resizeCodeMirror ( ) { int hdr = ( header.getOffsetHeight ( ) ) + ( diffTable.getHeaderHeight ( ) ) ; cmA.adjustHeight ( hdr ) ; cmB.adjustHeight ( hdr ) ; }
Source:
public java.util.Map < java.lang.String , com.j2bugzilla.rpc.GetLegalValues.Fields > getFields ( ) { java.util.Map < java.lang.String , com.j2bugzilla.rpc.GetLegalValues.Fields > fields = new java.util.HashMap < java.lang.String , com.j2bugzilla.rpc.GetLegalValues.Fields > ( ) ; fields.put ( "status" , Fields.STATUS ) ; return fields ; }

Target:
public java.util.Map < java.lang.String , com.j2bugzilla.rpc.GetLegalValues.Fields > getFields ( ) { java.util.Map < java.lang.String , com.j2bugzilla.rpc.GetLegalValues.Fields > fields = new java.util.HashMap < java.lang.String , com.j2bugzilla.rpc.GetLegalValues.Fields > ( ) ; fields.put ( "status" , Fields.STATUS ) ; fields.put ( "resolution" , Fields.RESOLUTION ) ; return fields ; }