Search in sources :

Example 71 with PersonIdent

use of org.eclipse.jgit.lib.PersonIdent in project gitiles by GerritCodeReview.

the class IdentRevFilterTest method matchesName.

@Test
public void matchesName() throws Exception {
    IdentRevFilter filter = IdentRevFilter.author("eSt");
    assertThat(filter.matchesPerson(new PersonIdent("eSt", "null@google.com"))).isTrue();
    assertThat(filter.matchesPerson(new PersonIdent("eStablish", "null@google.com"))).isTrue();
    assertThat(filter.matchesPerson(new PersonIdent("teSt", "null@google.com"))).isTrue();
    assertThat(filter.matchesPerson(new PersonIdent("teSting", "null@google.com"))).isTrue();
}
Also used : PersonIdent(org.eclipse.jgit.lib.PersonIdent) Test(org.junit.Test)

Example 72 with PersonIdent

use of org.eclipse.jgit.lib.PersonIdent in project gitiles by GerritCodeReview.

the class DateFormatterTest method isoWithUtc.

@Test
public void isoWithUtc() throws Exception {
    PersonIdent ident = newIdent("Mon Jan 2 15:04:05 2006", "-0700");
    DateFormatter df = new DateFormatter(Optional.of(getTimeZone("UTC")), ISO);
    assertThat(df.format(ident)).isEqualTo("2006-01-02 22:04:05");
}
Also used : PersonIdent(org.eclipse.jgit.lib.PersonIdent) Test(org.junit.Test)

Example 73 with PersonIdent

use of org.eclipse.jgit.lib.PersonIdent in project gitiles by GerritCodeReview.

the class DateFormatterTest method defaultWithOtherTimeZone.

@Test
public void defaultWithOtherTimeZone() throws Exception {
    PersonIdent ident = newIdent("Mon Jan 2 15:04:05 2006", "-0700");
    DateFormatter df = new DateFormatter(Optional.of(getTimeZone("GMT-0400")), DEFAULT);
    assertThat(df.format(ident)).isEqualTo("Mon Jan 02 18:04:05 2006");
}
Also used : PersonIdent(org.eclipse.jgit.lib.PersonIdent) Test(org.junit.Test)

Example 74 with PersonIdent

use of org.eclipse.jgit.lib.PersonIdent in project gitiles by GerritCodeReview.

the class DateFormatterTest method isoWithOtherTimeZone.

@Test
public void isoWithOtherTimeZone() throws Exception {
    PersonIdent ident = newIdent("Mon Jan 2 15:04:05 2006", "-0700");
    DateFormatter df = new DateFormatter(Optional.of(getTimeZone("GMT-0400")), ISO);
    assertThat(df.format(ident)).isEqualTo("2006-01-02 18:04:05");
}
Also used : PersonIdent(org.eclipse.jgit.lib.PersonIdent) Test(org.junit.Test)

Example 75 with PersonIdent

use of org.eclipse.jgit.lib.PersonIdent in project gitiles by GerritCodeReview.

the class DateFormatterTest method defaultIncludingTimeZone.

@Test
public void defaultIncludingTimeZone() throws Exception {
    PersonIdent ident = newIdent("Mon Jan 2 15:04:05 2006", "-0700");
    DateFormatter df = new DateFormatter(Optional.empty(), DEFAULT);
    assertThat(df.format(ident)).isEqualTo("Mon Jan 02 15:04:05 2006 -0700");
}
Also used : PersonIdent(org.eclipse.jgit.lib.PersonIdent) Test(org.junit.Test)

Aggregations

PersonIdent (org.eclipse.jgit.lib.PersonIdent)86 RevCommit (org.eclipse.jgit.revwalk.RevCommit)23 Test (org.junit.Test)21 CommitBuilder (org.eclipse.jgit.lib.CommitBuilder)19 ObjectId (org.eclipse.jgit.lib.ObjectId)18 GerritPersonIdent (com.google.gerrit.server.GerritPersonIdent)15 RevWalk (org.eclipse.jgit.revwalk.RevWalk)13 Change (com.google.gerrit.reviewdb.client.Change)12 ObjectInserter (org.eclipse.jgit.lib.ObjectInserter)12 Repository (org.eclipse.jgit.lib.Repository)11 Account (com.google.gerrit.reviewdb.client.Account)10 IOException (java.io.IOException)9 RefUpdate (org.eclipse.jgit.lib.RefUpdate)9 Ref (org.eclipse.jgit.lib.Ref)8 TestRepository (org.eclipse.jgit.junit.TestRepository)7 Date (java.util.Date)6 Result (org.eclipse.jgit.lib.RefUpdate.Result)6 ArrayList (java.util.ArrayList)5 AbstractDaemonTest (com.google.gerrit.acceptance.AbstractDaemonTest)4 ResourceConflictException (com.google.gerrit.extensions.restapi.ResourceConflictException)4