-
Notifications
You must be signed in to change notification settings - Fork 142
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:jcabi/jcabi-github
- Loading branch information
Showing
4 changed files
with
109 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,6 +37,7 @@ | |
import org.hamcrest.MatcherAssert; | ||
import org.hamcrest.Matchers; | ||
import org.junit.Assume; | ||
import org.junit.Ignore; | ||
import org.junit.Rule; | ||
import org.junit.Test; | ||
|
||
|
@@ -45,7 +46,7 @@ | |
* @author Andres Candal ([email protected]) | ||
* @version $Id$ | ||
* @since 0.8 | ||
* @checkstyle MultipleStringLiterals (300 lines) | ||
* @checkstyle MultipleStringLiterals (500 lines) | ||
*/ | ||
@SuppressWarnings("PMD.AvoidDuplicateLiterals") | ||
public final class RtContentsITCase { | ||
|
@@ -256,6 +257,68 @@ public void getContent() throws Exception { | |
} | ||
} | ||
|
||
/** | ||
* RtContents can iterate content. | ||
* @throws Exception If some problem inside | ||
* @todo #863 unignore after Contents#get is implemented for | ||
* directories (#968 and #903) | ||
*/ | ||
@Test | ||
@Ignore | ||
public void iteratesContent() throws Exception { | ||
final Repos repos = github().repos(); | ||
final Repo repo = this.rule.repo(repos); | ||
try { | ||
final String afile = RandomStringUtils.randomAlphanumeric(Tv.TEN); | ||
final String dir = RandomStringUtils.randomAlphanumeric(Tv.TEN); | ||
final String bfile = String.format( | ||
"%s/%s", | ||
dir, | ||
RandomStringUtils.randomAlphanumeric(Tv.TEN) | ||
); | ||
final String message = String.format("testMessage"); | ||
final Contents contents = repos.get(repo.coordinates()).contents(); | ||
contents.create( | ||
this.jsonObject( | ||
afile, | ||
new String( | ||
Base64.encodeBase64( | ||
String.format( | ||
"content a:%d", | ||
System.currentTimeMillis() | ||
).getBytes() | ||
) | ||
), | ||
message | ||
) | ||
); | ||
contents.create( | ||
this.jsonObject( | ||
bfile, | ||
new String( | ||
Base64.encodeBase64( | ||
String.format( | ||
"content b:%d", | ||
System.currentTimeMillis() | ||
).getBytes() | ||
) | ||
), | ||
message | ||
) | ||
); | ||
final Iterable<Content> iterated = contents.iterate("", "master"); | ||
MatcherAssert.assertThat( | ||
iterated, | ||
Matchers.allOf( | ||
Matchers.hasItems(contents.get(afile), contents.get(dir)), | ||
Matchers.<Content>iterableWithSize(Tv.THREE) | ||
) | ||
); | ||
} finally { | ||
repos.remove(repo.coordinates()); | ||
} | ||
} | ||
|
||
/** | ||
* RtContents can check whether content exists or not. | ||
* @throws Exception if any problem inside. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters