Skip to content
This repository was archived by the owner on Aug 23, 2023. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,17 @@
import junit.framework.TestCase;

import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;

public class DescriptionMetadataScrubberTest extends TestCase {

private static final RevisionMetadata REVISION_METADATA =
private static final DateTime DATE_TIME = new DateTime(1L);

private static final RevisionMetadata REVISION_METADATA =
new RevisionMetadata(
"commit_number",
"author@google.com",
new DateTime(1L),
DATE_TIME,
"some changes",
ImmutableList.of(
Revision.create("parentId1", "repo"), Revision.create("parentId2", "repo")));
Expand All @@ -41,7 +44,7 @@ public void testNonDescriptionFieldsUnaffacted() {
new RevisionMetadata(
"commit_number",
"author@google.com",
new DateTime(1L),
DATE_TIME,
"some changes!!!",
ImmutableList.of(
Revision.create("parentId1", "repo"), Revision.create("parentId2", "repo")));
Expand All @@ -60,12 +63,13 @@ public String getLogFormat() {
}

public void testVariousScrubbingFormats() {
assertFormatResults("{description} on {date}", "some changes on 1969/12/31");
String date = DateTimeFormat.forPattern("yyyy/MM/dd").print(DATE_TIME);
assertFormatResults("{description} on {date}", "some changes on " + date);
assertFormatResults(
"{description} on {date}\nby: {author}",
"some changes on 1969/12/31\nby: author@google.com");
"some changes on " + date + "\nby: author@google.com");
assertFormatResults(
"{date} saw the birth of {id}", "1969/12/31 saw the birth of commit_number");
"{date} saw the birth of {id}", date + " saw the birth of commit_number");
assertFormatResults("my parents are ({parents})", "my parents are (parentId1, parentId2)");
}

Expand Down