DebtModelBackup debtModelBackup;
@Before
- public void setUp() throws Exception {
+ public void setUp() {
userSessionRule.setGlobalPermissions(GlobalPermissions.SYSTEM_ADMIN);
when(system2.now()).thenReturn(now.getTime());
}
@Test
- public void plugin_name_and_version() throws Exception {
+ public void plugin_name_and_version() {
when(repo.getPluginInfos()).thenReturn(Arrays.asList(
new PluginInfo("key-1")
.setName("plugin-1")
private Request request = mock(Request.class);
@Before
- public void wireMocks() throws Exception {
+ public void wireMocks() {
when(dbClient.openSession(anyBoolean())).thenReturn(dbSession);
when(dbSession.getMapper(IsAliveMapper.class)).thenReturn(isAliveMapper);
}
@Test
- public void action_status_is_defined() throws Exception {
+ public void action_status_is_defined() {
WsTester wsTester = new WsTester();
WebService.NewController newController = wsTester.context().createController(DUMMY_CONTROLLER_KEY);
public class InstalledPluginReferentialFactoryTest {
@Test
- public void should_create_plugin_referential() throws IOException {
+ public void should_create_plugin_referential() {
PluginInfo info = new PluginInfo("foo");
PluginRepository pluginRepository = mock(PluginRepository.class);
when(pluginRepository.getPluginInfos()).thenReturn(newArrayList(info));
}
@Test
- public void only_statics() throws Exception {
+ public void only_statics() {
assertThat(TestUtils.hasOnlyPrivateConstructors(MimeTypes.class)).isTrue();
}
}
public class PluginReferentialMetadataConverterTest {
@Test
- public void should_convert_info_to_plugin_referential() throws IOException {
+ public void should_convert_info_to_plugin_referential() {
PluginInfo info = new PluginInfo("foo");
PluginReferential pluginReferential = PluginReferentialMetadataConverter.getInstalledPluginReferential(newArrayList(info));
}
@Test
- public void should_not_add_core_plugin() throws IOException {
+ public void should_not_add_core_plugin() {
PluginInfo info = new PluginInfo("foo").setCore(true);
PluginReferential pluginReferential = PluginReferentialMetadataConverter.getInstalledPluginReferential(newArrayList(info));
}
@After
- public void tearDown() throws Exception {
+ public void tearDown() {
underTest.stop();
}
* to test sensibility to null values.
*/
@Test
- public void no_plugins_at_all_on_startup() throws Exception {
+ public void no_plugins_at_all_on_startup() {
underTest.start();
assertThat(underTest.getPluginInfos()).isEmpty();
}
@Test
- public void fail_to_get_missing_plugins() throws Exception {
+ public void fail_to_get_missing_plugins() {
try {
underTest.getPluginInfo("unknown");
fail();
}
@Test
- public void plugin_is_incompatible_if_no_entry_point_class() throws Exception {
+ public void plugin_is_incompatible_if_no_entry_point_class() {
PluginInfo plugin = new PluginInfo("foo").setName("Foo");
assertThat(ServerPluginRepository.isCompatible(plugin, server, Collections.<String, PluginInfo>emptyMap())).isFalse();
assertThat(logs.logs()).contains("Plugin Foo [foo] is ignored because entry point class is not defined");
* Some plugins can only extend the classloader of base plugin, without declaring new extensions.
*/
@Test
- public void plugin_is_compatible_if_no_entry_point_class_but_extend_other_plugin() throws Exception {
+ public void plugin_is_compatible_if_no_entry_point_class_but_extend_other_plugin() {
PluginInfo basePlugin = new PluginInfo("base").setMainClass("org.bar.Bar");
PluginInfo plugin = new PluginInfo("foo").setBasePlugin("base");
Map<String, PluginInfo> plugins = ImmutableMap.of("base", basePlugin, "foo", plugin);
.setImplementationBuild("9ce9d330c313c296fab051317cc5ad4b26319e07");
}
- public PluginInfo newPluginInfo(int id) throws IOException {
+ public PluginInfo newPluginInfo(int id) {
return new PluginInfo("key" + id).setName("name" + id);
}
}
}
@Test(expected = UnauthorizedException.class)
- public void do_not_delete_if_not_granted() throws Exception {
+ public void do_not_delete_if_not_granted() {
userSessionRule.setGlobalPermissions(GlobalPermissions.SCAN_EXECUTION);
service.delete(RuleKey.of("java", "S001"));
RubyUserSession underTest = new RubyUserSession(platform);
@Before
- public void setUp() throws Exception {
+ public void setUp() {
when(platform.getContainer()).thenReturn(componentContainer);
when(componentContainer.getComponentByType(ThreadLocalUserSession.class)).thenReturn(threadLocalUserSession);
}
public ExpectedException thrown = ExpectedException.none();
@Before
- public void setUp() throws Exception {
+ public void setUp() {
threadLocalUserSession.remove();
}
@Test
- public void getSession_get_anonymous_by_default() throws Exception {
+ public void getSession_get_anonymous_by_default() {
UserSession session = threadLocalUserSession.get();
assertThat(session).isNotNull();
}
@Test
- public void get_session() throws Exception {
+ public void get_session() {
threadLocalUserSession.set(new MockUserSession("karadoc").setUserId(123).setLocale(Locale.FRENCH));
UserSession session = threadLocalUserSession.get();
}
@After
- public void tearDown() throws Exception {
+ public void tearDown() {
threadLocalUserSession.remove();
}
BatchPluginRepository underTest = new BatchPluginRepository(installer, loader);
@Test
- public void install_and_load_plugins() throws Exception {
+ public void install_and_load_plugins() {
PluginInfo info = new PluginInfo("squid");
ImmutableMap<String, PluginInfo> infos = ImmutableMap.of("squid", info);
Plugin instance = mock(Plugin.class);
}
@Test
- public void fail_if_requesting_missing_plugin() throws Exception {
+ public void fail_if_requesting_missing_plugin() {
underTest.start();
try {
}
@Test
- public void scanMultiModuleProject() throws IOException {
+ public void scanMultiModuleProject() {
File projectDir = new File("src/test/resources/mediumtest/xoo/multi-modules-sample");
TaskResult result = tester
.newScanTask(new File(projectDir, "sonar-project.properties"))
IsAliveMapper underTest;
@Before
- public void setUp() throws Exception {
+ public void setUp() {
session = dbTester.myBatis().openSession(false);
underTest = session.getMapper(IsAliveMapper.class);
}
@After
- public void tearDown() throws Exception {
+ public void tearDown() {
session.close();
}
@Test
- public void isAlive_works_for_current_vendors() throws Exception {
+ public void isAlive_works_for_current_vendors() {
assertThat(underTest.isAlive()).isEqualTo(IsAliveMapper.IS_ALIVE_RETURNED_VALUE);
}
}
}
@Test
- public void generate_key_of_object() throws Exception {
+ public void generate_key_of_object() {
assertThat(keys.of(new FakeComponent())).isEqualTo("org.sonar.core.platform.ComponentKeysTest.FakeComponent-fake");
}
}
@Test
- public void create_from_file() throws Exception {
+ public void create_from_file() {
File checkstyleJar = FileUtils.toFile(getClass().getResource("/org/sonar/core/plugins/sonar-checkstyle-plugin-2.8.jar"));
PluginInfo checkstyleInfo = PluginInfo.create(checkstyleJar);
assertThat(pluginInfo.toString()).isEqualTo("[java / 1.1 / SHA1]");
}
- PluginInfo withMinSqVersion(@Nullable String version) throws IOException {
+ PluginInfo withMinSqVersion(@Nullable String version) {
PluginInfo pluginInfo = new PluginInfo("foo");
if (version != null) {
pluginInfo.setMinimalSqVersion(Version.create(version));
public TemporaryFolder temp = new TemporaryFolder();
@Test
- public void load_and_unload_plugins() throws Exception {
+ public void load_and_unload_plugins() {
File checkstyleJar = FileUtils.toFile(getClass().getResource("/org/sonar/core/plugins/sonar-checkstyle-plugin-2.8.jar"));
PluginInfo checkstyleInfo = PluginInfo.create(checkstyleJar);