* @throws Exception - If something goes wrong.
* @checkstyle IndentationCheck (20 lines)
*/
@Test
public void createsTag() throws Exception {
final MkContainer container = new MkGrizzlyContainer().next(
new MkAnswer.Simple(
HttpURLConnection.HTTP_CREATED,
"{\"sha\":\"0abcd89jcabitest\",\"tag\":\"v.0.1\"}"
)
).next(
new MkAnswer.Simple(
HttpURLConnection.HTTP_CREATED,
"{\"ref\":\"refs/heads/feature-a\"}"
)
).start();
final Tags tags = new RtTags(
new ApacheRequest(container.home()),
repo()
);
final JsonObject tagger = Json.createObjectBuilder()
.add("name", "Scott").add("email", "scott@gmail.com")
.add("date", "2011-06-17T14:53:35-07:00").build();
final JsonObject input = Json.createObjectBuilder()
.add("tag", "v.0.1").add("message", "initial version")
.add("object", "07cd4r45Test444").add("type", "commit")
.add("tagger", tagger).build();
try {
MatcherAssert.assertThat(
tags.create(input),
Matchers.instanceOf(Tag.class)
);
MatcherAssert.assertThat(
container.take().method(),
Matchers.equalTo(Request.POST)
);
MatcherAssert.assertThat(
container.take().method(),
Matchers.equalTo(Request.POST)
);
} finally {
container.stop();
}
}