final ConcurrentHashMap<String, String> config =
new ConcurrentHashMap<String, String>(2);
config.put("url", "http://example.com");
config.put("content_type", "json");
final String body = RtHooksTest.hook(name, config).toString();
final MkContainer container = new MkGrizzlyContainer().next(
new MkAnswer.Simple(HttpURLConnection.HTTP_CREATED, body)
).next(new MkAnswer.Simple(HttpURLConnection.HTTP_OK, body)).start();
final Hooks hooks = new RtHooks(
new JdkRequest(container.home()),
RtHooksTest.repo()
);
try {
final Hook hook = hooks.create(name, config);
MatcherAssert.assertThat(
container.take().method(),
Matchers.equalTo(Request.POST)
);
MatcherAssert.assertThat(
new Hook.Smart(hook).name(),
Matchers.equalTo(name)
);
} finally {
container.stop();
}
}