@Test public void contain_its_own_classloader() { assertThat(i18nClassloader.getResource("org/sonar/l10n/core.properties")).isNotNull(); }
@Test public void getResourceWithNameParam_returnURL() throws Exception { //when URL url = loader.getResource(fileName); //then Assertions.assertThat(url).isNotNull(); }
@Test public void getResourceWithClass() throws Exception { URL resource = ResourceUtils.getResource(getClass(), resourceName); assertThat(resource).isNotNull(); assertThat(IOUtils.toString(resource, Charset.defaultCharset())).contains(RESOURCE_CONTENT); } }
@Test public void getResource() throws Exception { URL resource = ResourceUtils.getResource(resourceName); assertThat(resource).isNotNull(); assertThat(IOUtils.toString(resource, Charset.defaultCharset())).contains(RESOURCE_CONTENT); }
@Test public void test_definition() { WebService.Action action = tester.getDef(); assertThat(action.key()).isEqualTo("changelog"); assertThat(action.isPost()).isFalse(); assertThat(action.isInternal()).isFalse(); assertThat(action.params()).hasSize(1); assertThat(action.responseExample()).isNotNull(); }
@Test public void test_definition() { WebService.Action action = tester.getDef(); assertThat(action.key()).isEqualTo("edit_comment"); assertThat(action.isPost()).isTrue(); assertThat(action.isInternal()).isFalse(); assertThat(action.params()).hasSize(2); assertThat(action.responseExample()).isNotNull(); }
@Test public void test_definition() { WebService.Action action = tester.getDef(); assertThat(action.key()).isEqualTo("bulk_change"); assertThat(action.isPost()).isTrue(); assertThat(action.isInternal()).isFalse(); assertThat(action.params()).hasSize(10); assertThat(action.responseExample()).isNotNull(); }
@Test public void test_definition() { WebService.Action action = tester.getDef(); assertThat(action.key()).isEqualTo("delete_comment"); assertThat(action.isPost()).isTrue(); assertThat(action.isInternal()).isFalse(); assertThat(action.params()).hasSize(1); assertThat(action.responseExample()).isNotNull(); }
@Test public void test_definition() { WebService.Action action = tester.getDef(); assertThat(action.key()).isEqualTo("set_type"); assertThat(action.isPost()).isTrue(); assertThat(action.isInternal()).isFalse(); assertThat(action.params()).hasSize(2); assertThat(action.responseExample()).isNotNull(); }
@Test public void test_definition() { WebService.Action action = tester.getDef(); assertThat(action.key()).isEqualTo("set_severity"); assertThat(action.isPost()).isTrue(); assertThat(action.isInternal()).isFalse(); assertThat(action.params()).hasSize(2); assertThat(action.responseExample()).isNotNull(); }
@Test public void verify_definition() { WebService.Action definition = underTest.getDef(); assertThat(definition.key()).isEqualTo("health"); assertThat(definition.isPost()).isFalse(); assertThat(definition.description()).isNotEmpty(); assertThat(definition.since()).isEqualTo("6.6"); assertThat(definition.isInternal()).isFalse(); assertThat(definition.responseExample()).isNotNull(); assertThat(definition.params()).isEmpty(); }
@Test public void verify_definition() { WebService.Action definition = underTest.getDef(); assertThat(definition.key()).isEqualTo("health"); assertThat(definition.isPost()).isFalse(); assertThat(definition.description()).isNotEmpty(); assertThat(definition.since()).isEqualTo("6.6"); assertThat(definition.isInternal()).isFalse(); assertThat(definition.responseExample()).isNotNull(); assertThat(definition.params()).isEmpty(); }
@Test public void aggregate_plugin_classloaders() { URLClassLoader checkstyle = newCheckstyleClassloader(); I18nClassloader i18nClassloader = new I18nClassloader(Lists.newArrayList(checkstyle)); assertThat(i18nClassloader.getResource("org/sonar/l10n/checkstyle.properties")).isNotNull(); assertThat(i18nClassloader.getResource("org/sonar/l10n/checkstyle.properties").getFile()).endsWith("checkstyle.properties"); }
@Test public void response_example() { MetricWs metricWs = new MetricWs(); metricWs.define(context); WebService.Action action = context.controller("api/metric").action("create"); assertThat(action.responseExampleFormat()).isEqualTo("txt"); assertThat(action.responseExample()).isNotNull(); assertThat(StringUtils.trim(action.responseExampleAsString())).isEqualTo("example of WS response"); }
@Test public void action_installed_is_defined() { Action action = tester.getDef(); assertThat(action.isPost()).isFalse(); assertThat(action.description()).isNotEmpty(); assertThat(action.responseExample()).isNotNull(); }
@Test public void action_status_is_defined() { WebService.Action action = underTest.getDef(); assertThat(action.isPost()).isFalse(); assertThat(action.description()).isNotEmpty(); assertThat(action.responseExample()).isNotNull(); assertThat(action.params()).isEmpty(); }
@Test public void action_updates_is_defined() { WsTester wsTester = new WsTester(); WebService.NewController newController = wsTester.context().createController(DUMMY_CONTROLLER_KEY); underTest.define(newController); newController.done(); WebService.Controller controller = wsTester.controller(DUMMY_CONTROLLER_KEY); assertThat(controller.actions()).extracting("key").containsExactly("upgrades"); WebService.Action action = controller.actions().iterator().next(); assertThat(action.isPost()).isFalse(); assertThat(action.description()).isNotEmpty(); assertThat(action.responseExample()).isNotNull(); assertThat(action.params()).isEmpty(); }
@Test public void action_available_is_defined() { logInAsSystemAdministrator(); WsTester wsTester = new WsTester(); WebService.NewController newController = wsTester.context().createController(DUMMY_CONTROLLER_KEY); underTest.define(newController); newController.done(); WebService.Controller controller = wsTester.controller(DUMMY_CONTROLLER_KEY); assertThat(controller.actions()).extracting("key").containsExactly("available"); WebService.Action action = controller.actions().iterator().next(); assertThat(action.isPost()).isFalse(); assertThat(action.description()).isNotEmpty(); assertThat(action.responseExample()).isNotNull(); }
@Test public void action_updatable_is_defined() { logInAsSystemAdministrator(); WsTester wsTester = new WsTester(); WebService.NewController newController = wsTester.context().createController(DUMMY_CONTROLLER_KEY); underTest.define(newController); newController.done(); WebService.Controller controller = wsTester.controller(DUMMY_CONTROLLER_KEY); assertThat(controller.actions()).extracting("key").containsExactly("updates"); WebService.Action action = controller.actions().iterator().next(); assertThat(action.isPost()).isFalse(); assertThat(action.description()).isNotEmpty(); assertThat(action.responseExample()).isNotNull(); }
@Test public void action_pending_is_defined() { logInAsSystemAdministrator(); WsTester wsTester = new WsTester(); WebService.NewController newController = wsTester.context().createController(DUMMY_CONTROLLER_KEY); underTest.define(newController); newController.done(); WebService.Controller controller = wsTester.controller(DUMMY_CONTROLLER_KEY); assertThat(controller.actions()).extracting("key").containsExactly("pending"); WebService.Action action = controller.actions().iterator().next(); assertThat(action.isPost()).isFalse(); assertThat(action.description()).isNotEmpty(); assertThat(action.responseExample()).isNotNull(); }