AbstractQueryChangesTest: Add test coverage for since: and until: predicates
Bug: Issue 8605 Change-Id: I85570c019fd00cf1503a4f44170589ab37b4d50a
This commit is contained in:
		| @@ -1131,7 +1131,7 @@ public abstract class AbstractQueryChangesTest extends GerritServerTests { | |||||||
|   } |   } | ||||||
|  |  | ||||||
|   @Test |   @Test | ||||||
|   public void byBefore() throws Exception { |   public void byBeforeUntil() throws Exception { | ||||||
|     long thirtyHoursInMs = MILLISECONDS.convert(30, HOURS); |     long thirtyHoursInMs = MILLISECONDS.convert(30, HOURS); | ||||||
|     resetTimeWithClockStep(thirtyHoursInMs, MILLISECONDS); |     resetTimeWithClockStep(thirtyHoursInMs, MILLISECONDS); | ||||||
|     TestRepository<Repo> repo = createProject("repo"); |     TestRepository<Repo> repo = createProject("repo"); | ||||||
| @@ -1140,20 +1140,22 @@ public abstract class AbstractQueryChangesTest extends GerritServerTests { | |||||||
|     Change change2 = insert(repo, newChange(repo), null, new Timestamp(startMs + thirtyHoursInMs)); |     Change change2 = insert(repo, newChange(repo), null, new Timestamp(startMs + thirtyHoursInMs)); | ||||||
|     TestTimeUtil.setClockStep(0, MILLISECONDS); |     TestTimeUtil.setClockStep(0, MILLISECONDS); | ||||||
|  |  | ||||||
|     assertQuery("before:2009-09-29"); |     for (String predicate : new String[] {"before:", "until:"}) { | ||||||
|     assertQuery("before:2009-09-30"); |       assertQuery(predicate + "2009-09-29"); | ||||||
|     assertQuery("before:\"2009-09-30 16:59:00 -0400\""); |       assertQuery(predicate + "2009-09-30"); | ||||||
|     assertQuery("before:\"2009-09-30 20:59:00 -0000\""); |       assertQuery(predicate + "\"2009-09-30 16:59:00 -0400\""); | ||||||
|     assertQuery("before:\"2009-09-30 20:59:00\""); |       assertQuery(predicate + "\"2009-09-30 20:59:00 -0000\""); | ||||||
|     assertQuery("before:\"2009-09-30 17:02:00 -0400\"", change1); |       assertQuery(predicate + "\"2009-09-30 20:59:00\""); | ||||||
|     assertQuery("before:\"2009-10-01 21:02:00 -0000\"", change1); |       assertQuery(predicate + "\"2009-09-30 17:02:00 -0400\"", change1); | ||||||
|     assertQuery("before:\"2009-10-01 21:02:00\"", change1); |       assertQuery(predicate + "\"2009-10-01 21:02:00 -0000\"", change1); | ||||||
|     assertQuery("before:2009-10-01", change1); |       assertQuery(predicate + "\"2009-10-01 21:02:00\"", change1); | ||||||
|     assertQuery("before:2009-10-03", change2, change1); |       assertQuery(predicate + "2009-10-01", change1); | ||||||
|  |       assertQuery(predicate + "2009-10-03", change2, change1); | ||||||
|  |     } | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   @Test |   @Test | ||||||
|   public void byAfter() throws Exception { |   public void byAfterSince() throws Exception { | ||||||
|     long thirtyHoursInMs = MILLISECONDS.convert(30, HOURS); |     long thirtyHoursInMs = MILLISECONDS.convert(30, HOURS); | ||||||
|     resetTimeWithClockStep(thirtyHoursInMs, MILLISECONDS); |     resetTimeWithClockStep(thirtyHoursInMs, MILLISECONDS); | ||||||
|     TestRepository<Repo> repo = createProject("repo"); |     TestRepository<Repo> repo = createProject("repo"); | ||||||
| @@ -1162,11 +1164,13 @@ public abstract class AbstractQueryChangesTest extends GerritServerTests { | |||||||
|     Change change2 = insert(repo, newChange(repo), null, new Timestamp(startMs + thirtyHoursInMs)); |     Change change2 = insert(repo, newChange(repo), null, new Timestamp(startMs + thirtyHoursInMs)); | ||||||
|     TestTimeUtil.setClockStep(0, MILLISECONDS); |     TestTimeUtil.setClockStep(0, MILLISECONDS); | ||||||
|  |  | ||||||
|     assertQuery("after:2009-10-03"); |     for (String predicate : new String[] {"after:", "since:"}) { | ||||||
|     assertQuery("after:\"2009-10-01 20:59:59 -0400\"", change2); |       assertQuery(predicate + "2009-10-03"); | ||||||
|     assertQuery("after:\"2009-10-01 20:59:59 -0000\"", change2); |       assertQuery(predicate + "\"2009-10-01 20:59:59 -0400\"", change2); | ||||||
|     assertQuery("after:2009-10-01", change2); |       assertQuery(predicate + "\"2009-10-01 20:59:59 -0000\"", change2); | ||||||
|     assertQuery("after:2009-09-30", change2, change1); |       assertQuery(predicate + "2009-10-01", change2); | ||||||
|  |       assertQuery(predicate + "2009-09-30", change2, change1); | ||||||
|  |     } | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   @Test |   @Test | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 David Pursehouse
					David Pursehouse