@@ -914,10 +914,62 @@ public void getCommitsBetweenOver250() throws Exception {
914
914
assertThat (compare .getTotalCommits (), is (283 ));
915
915
assertThat (actualCount , is (250 ));
916
916
assertThat (mockGitHub .getRequestCount (), equalTo (startingCount + 1 ));
917
- }
918
917
919
- @ Test
920
- public void getCommitsBetweenPaginatedOver250 () throws Exception {
918
+ // Additional GHCompare checks
919
+ assertThat (compare .getAheadBy (), equalTo (283 ));
920
+ assertThat (compare .getBehindBy (), equalTo (0 ));
921
+ assertThat (compare .getStatus (), equalTo (GHCompare .Status .ahead ));
922
+ assertThat (compare .getDiffUrl ().toString (),
923
+ endsWith (
924
+ "compare/4261c42949915816a9f246eb14c3dfd21a637bc2...94ff089e60064bfa43e374baeb10846f7ce82f40.diff" ));
925
+ assertThat (compare .getHtmlUrl ().toString (),
926
+ endsWith (
927
+ "compare/4261c42949915816a9f246eb14c3dfd21a637bc2...94ff089e60064bfa43e374baeb10846f7ce82f40" ));
928
+ assertThat (compare .getPatchUrl ().toString (),
929
+ endsWith (
930
+ "compare/4261c42949915816a9f246eb14c3dfd21a637bc2...94ff089e60064bfa43e374baeb10846f7ce82f40.patch" ));
931
+ assertThat (compare .getPermalinkUrl ().toString (),
932
+ endsWith ("compare/hub4j-test-org:4261c42...hub4j-test-org:94ff089" ));
933
+ assertThat (compare .getUrl ().toString (),
934
+ endsWith (
935
+ "compare/4261c42949915816a9f246eb14c3dfd21a637bc2...94ff089e60064bfa43e374baeb10846f7ce82f40" ));
936
+
937
+ assertThat (compare .getBaseCommit ().getSHA1 (), equalTo ("4261c42949915816a9f246eb14c3dfd21a637bc2" ));
938
+
939
+ assertThat (compare .getMergeBaseCommit ().getSHA1 (), equalTo ("4261c42949915816a9f246eb14c3dfd21a637bc2" ));
940
+ // it appears this field is not present in the returned JSON. Strange.
941
+ assertThat (compare .getMergeBaseCommit ().getCommit ().getSha (), nullValue ());
942
+ assertThat (compare .getMergeBaseCommit ().getCommit ().getUrl (),
943
+ endsWith ("/commits/4261c42949915816a9f246eb14c3dfd21a637bc2" ));
944
+ assertThat (compare .getMergeBaseCommit ().getCommit ().getMessage (),
945
+ endsWith ("[maven-release-plugin] prepare release github-api-1.123" ));
946
+ assertThat (compare .getMergeBaseCommit ().getCommit ().getAuthor ().getName (), equalTo ("Liam Newman" ));
947
+ assertThat (compare .getMergeBaseCommit ().getCommit ().getCommitter ().getName (), equalTo ("Liam Newman" ));
948
+
949
+ assertThat (compare .getMergeBaseCommit ().getCommit ().getTree ().getSha (),
950
+ equalTo ("5da98090976978c93aba0bdfa550e05675543f99" ));
951
+ assertThat (compare .getMergeBaseCommit ().getCommit ().getTree ().getUrl (),
952
+ endsWith ("/git/trees/5da98090976978c93aba0bdfa550e05675543f99" ));
953
+
954
+ assertThat (compare .getFiles ().length , equalTo (300 ));
955
+ assertThat (compare .getFiles ()[0 ].getFileName (), equalTo (".github/PULL_REQUEST_TEMPLATE.md" ));
956
+ assertThat (compare .getFiles ()[0 ].getLinesAdded (), equalTo (8 ));
957
+ assertThat (compare .getFiles ()[0 ].getLinesChanged (), equalTo (15 ));
958
+ assertThat (compare .getFiles ()[0 ].getLinesDeleted (), equalTo (7 ));
959
+ assertThat (compare .getFiles ()[0 ].getFileName (), equalTo (".github/PULL_REQUEST_TEMPLATE.md" ));
960
+ assertThat (compare .getFiles ()[0 ].getPatch (), startsWith ("@@ -1,15 +1,16 @@" ));
961
+ assertThat (compare .getFiles ()[0 ].getPreviousFilename (), nullValue ());
962
+ assertThat (compare .getFiles ()[0 ].getStatus (), equalTo ("modified" ));
963
+ assertThat (compare .getFiles ()[0 ].getSha (), equalTo ("e4234f5f6f39899282a6ef1edff343ae1269222e" ));
964
+
965
+ assertThat (compare .getFiles ()[0 ].getBlobUrl ().toString (),
966
+ endsWith ("/blob/94ff089e60064bfa43e374baeb10846f7ce82f40/.github/PULL_REQUEST_TEMPLATE.md" ));
967
+ assertThat (compare .getFiles ()[0 ].getRawUrl ().toString (),
968
+ endsWith ("/raw/94ff089e60064bfa43e374baeb10846f7ce82f40/.github/PULL_REQUEST_TEMPLATE.md" ));
969
+ }
970
+
971
+ @ Test
972
+ public void getCommitsBetweenPaged () throws Exception {
921
973
GHRepository repository = getRepository ();
922
974
int startingCount = mockGitHub .getRequestCount ();
923
975
repository .setCompareUsePaginatedCommits (true );
0 commit comments