diff options
author | Duarte Meneses <duarte.meneses@sonarsource.com> | 2019-12-09 09:34:43 -0600 |
---|---|---|
committer | SonarTech <sonartech@sonarsource.com> | 2019-12-10 20:46:09 +0100 |
commit | d1fd889554bccbb50122550899dbb66b90b04f78 (patch) | |
tree | 9cad838366292ee79b77ac3513403f7489b06355 /server/sonar-db-dao | |
parent | f86a1094588e4e47b3abf612891af0431653cd0e (diff) | |
download | sonarqube-d1fd889554bccbb50122550899dbb66b90b04f78.tar.gz sonarqube-d1fd889554bccbb50122550899dbb66b90b04f78.zip |
Fix code quality issues and reduce dependency on Guava
Diffstat (limited to 'server/sonar-db-dao')
24 files changed, 38 insertions, 39 deletions
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentKeyUpdaterDao.java b/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentKeyUpdaterDao.java index 214dfb66006..115d1661ac0 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentKeyUpdaterDao.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentKeyUpdaterDao.java @@ -22,7 +22,6 @@ package org.sonar.db.component; import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Lists; -import com.google.common.collect.Maps; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; @@ -128,7 +127,7 @@ public class ComponentKeyUpdaterDao implements Dao { branchModules.forEach(module -> branchBaseKeys.put(module.getKey(), branchBaseKey(module.getKey()))); }); - Map<ResourceDto, List<ResourceDto>> allResourcesByModuleMap = Maps.newHashMap(); + Map<ResourceDto, List<ResourceDto>> allResourcesByModuleMap = new HashMap<>(); for (ResourceDto module : modules) { allResourcesByModuleMap.put(module, mapper.selectProjectResources(module.getUuid())); } diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/metric/MetricDao.java b/server/sonar-db-dao/src/main/java/org/sonar/db/metric/MetricDao.java index ea7584a007c..e99075f7a52 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/metric/MetricDao.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/metric/MetricDao.java @@ -22,9 +22,9 @@ package org.sonar.db.metric; import com.google.common.base.Predicate; import com.google.common.collect.Collections2; import com.google.common.collect.Lists; -import com.google.common.collect.Maps; import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Set; @@ -68,9 +68,11 @@ public class MetricDao implements Dao { } public List<MetricDto> selectEnabled(DbSession session, @Nullable Boolean isCustom, int offset, int limit) { - Map<String, Object> properties = Maps.newHashMapWithExpectedSize(1); + Map<String, Object> properties; if (isCustom != null) { - properties.put("isCustom", isCustom); + properties = Collections.singletonMap("isCustom", isCustom); + } else { + properties = Collections.emptyMap(); } return mapper(session).selectAllEnabled(properties, new RowBounds(offset, limit)); diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/property/PropertiesDao.java b/server/sonar-db-dao/src/main/java/org/sonar/db/property/PropertiesDao.java index 77129395c49..2b2e7d57bf3 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/property/PropertiesDao.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/property/PropertiesDao.java @@ -303,9 +303,9 @@ public class PropertiesDao implements Dao { public void saveGlobalProperties(Map<String, String> properties) { try (DbSession session = mybatis.openSession(false)) { PropertiesMapper mapper = getMapper(session); - properties.entrySet().forEach(entry -> { - mapper.deleteGlobalProperty(entry.getKey()); - save(mapper, entry.getKey(), null, null, entry.getValue()); + properties.forEach((key, value) -> { + mapper.deleteGlobalProperty(key); + save(mapper, key, null, null, value); }); session.commit(); } diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/user/GroupMembershipDao.java b/server/sonar-db-dao/src/main/java/org/sonar/db/user/GroupMembershipDao.java index c1807736483..3b735c1213b 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/user/GroupMembershipDao.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/user/GroupMembershipDao.java @@ -21,10 +21,10 @@ package org.sonar.db.user; import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.ImmutableMap; -import com.google.common.collect.Maps; import com.google.common.collect.Multimap; import com.google.common.collect.Multiset; import java.util.Collection; +import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.ibatis.session.RowBounds; @@ -56,7 +56,7 @@ public class GroupMembershipDao implements Dao { } public Map<String, Integer> countUsersByGroups(DbSession session, Collection<Integer> groupIds) { - Map<String, Integer> result = Maps.newHashMap(); + Map<String, Integer> result = new HashMap<>(); executeLargeInputs( groupIds, input -> { diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/alm/ProjectAlmBindingDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/alm/ProjectAlmBindingDaoTest.java index df6b6ebd527..f51a0ff4314 100644 --- a/server/sonar-db-dao/src/test/java/org/sonar/db/alm/ProjectAlmBindingDaoTest.java +++ b/server/sonar-db-dao/src/test/java/org/sonar/db/alm/ProjectAlmBindingDaoTest.java @@ -236,7 +236,7 @@ public class ProjectAlmBindingDaoTest { underTest.insertOrUpdate(dbSession, BITBUCKETCLOUD, ANOTHER_REPO, "foo", null, "http://foo"); assertThat(underTest.selectByRepoIds(dbSession, GITHUB, Arrays.asList(A_REPO, ANOTHER_REPO, "foo"))) - .extracting(ProjectAlmBindingDto::getUuid, t -> t.getAlm(), ProjectAlmBindingDto::getRepoId, ProjectAlmBindingDto::getProjectUuid, + .extracting(ProjectAlmBindingDto::getUuid, ProjectAlmBindingDto::getAlm, ProjectAlmBindingDto::getRepoId, ProjectAlmBindingDto::getProjectUuid, ProjectAlmBindingDto::getUrl, ProjectAlmBindingDto::getGithubSlug) .containsExactlyInAnyOrder( tuple("uuid1", GITHUB, A_REPO, A_UUID, A_URL, A_GITHUB_SLUG), diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentKeyUpdaterDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentKeyUpdaterDaoTest.java index cff43fe24cb..b6a85927a0e 100644 --- a/server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentKeyUpdaterDaoTest.java +++ b/server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentKeyUpdaterDaoTest.java @@ -64,7 +64,7 @@ public class ComponentKeyUpdaterDaoTest { dbSession.commit(); assertThat(db.select("select uuid as \"UUID\", kee as \"KEE\" from projects")) - .extracting(t -> (String) t.get("UUID"), t -> (String) t.get("KEE")) + .extracting(t -> t.get("UUID"), t -> t.get("KEE")) .containsOnly( Tuple.tuple("A", "org.struts:struts"), Tuple.tuple("B", "struts:core"), @@ -278,7 +278,7 @@ public class ComponentKeyUpdaterDaoTest { dbSession.commit(); assertThat(db.select("select uuid as \"UUID\", kee as \"KEE\" from projects")) - .extracting(t -> (String) t.get("UUID"), t -> (String) t.get("KEE")) + .extracting(t -> t.get("UUID"), t -> t.get("KEE")) .containsOnly( Tuple.tuple("A", "org.apache.struts:struts"), Tuple.tuple("B", "org.apache.struts:struts-core"), @@ -298,7 +298,7 @@ public class ComponentKeyUpdaterDaoTest { dbSession.commit(); assertThat(db.select("select uuid as \"UUID\", kee as \"KEE\" from projects")) - .extracting(t -> (String) t.get("UUID"), t -> (String) t.get("KEE")) + .extracting(t -> t.get("UUID"), t -> t.get("KEE")) .containsOnly( Tuple.tuple("A", "org.struts:struts"), Tuple.tuple("B", "org.struts:struts-core"), @@ -337,7 +337,7 @@ public class ComponentKeyUpdaterDaoTest { dbSession.commit(); assertThat(db.select("select uuid as \"UUID\", kee as \"KEE\" from projects")) - .extracting(t -> (String) t.get("UUID"), t -> (String) t.get("KEE")) + .extracting(t -> t.get("UUID"), t -> t.get("KEE")) .containsOnly( Tuple.tuple("A", "org.apache.struts:struts"), Tuple.tuple("B", "org.apache.struts:struts-core"), diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/dump/DumpSQSchema.java b/server/sonar-db-dao/src/test/java/org/sonar/db/dump/DumpSQSchema.java index 49ebe22c378..cd16a5794db 100644 --- a/server/sonar-db-dao/src/test/java/org/sonar/db/dump/DumpSQSchema.java +++ b/server/sonar-db-dao/src/test/java/org/sonar/db/dump/DumpSQSchema.java @@ -25,6 +25,8 @@ import java.nio.charset.Charset; import java.sql.SQLException; import org.apache.commons.io.FileUtils; +import static java.nio.charset.StandardCharsets.UTF_8; + public class DumpSQSchema { public static void main(String[] args) { @@ -36,7 +38,7 @@ public class DumpSQSchema { System.exit(1); } - Charset charset = Charset.forName("UTF8"); + Charset charset = UTF_8; String oldContent = FileUtils.readFileToString(targetFile, charset); String newContent = dumper.dumpToText(); boolean upToDate = newContent.equals(oldContent); diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/issue/IssueMapperTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/issue/IssueMapperTest.java index 04bd0f63e8b..413de4c4ea1 100644 --- a/server/sonar-db-dao/src/test/java/org/sonar/db/issue/IssueMapperTest.java +++ b/server/sonar-db-dao/src/test/java/org/sonar/db/issue/IssueMapperTest.java @@ -73,7 +73,7 @@ public class IssueMapperTest { private System2 system2 = new AlwaysIncreasingSystem2(); @Before - public void setUp() throws Exception { + public void setUp() { OrganizationDto organizationDto = dbTester.organizations().insert(); project = ComponentTesting.newPrivateProjectDto(organizationDto); dbTester.getDbClient().componentDao().insert(dbSession, project); @@ -458,7 +458,7 @@ public class IssueMapperTest { ComponentDto component = randomComponent(organization); IssueDto issue = insertNewClosedIssue(component, ruleType); Date date = new Date(); - IssueChangeDto changes[] = new IssueChangeDto[] { + IssueChangeDto[] changes = new IssueChangeDto[] { insertToClosedDiff(issue, DateUtils.addDays(date, -10)), insertToClosedDiff(issue, DateUtils.addDays(date, -60)), insertToClosedDiff(issue, date), @@ -485,7 +485,7 @@ public class IssueMapperTest { ComponentDto component = randomComponent(organization); IssueDto issue = insertNewClosedIssue(component, ruleType); Date date = new Date(); - IssueChangeDto changes[] = new IssueChangeDto[] { + IssueChangeDto[] changes = new IssueChangeDto[] { insertToClosedDiff(issue, DateUtils.addDays(date, -10), Issue.STATUS_CLOSED, Issue.STATUS_REOPENED), insertToClosedDiff(issue, DateUtils.addDays(date, -60)), insertToClosedDiff(issue, date), diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/measure/LiveMeasureDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/measure/LiveMeasureDaoTest.java index 464f4e8be6c..e5d2dd85496 100644 --- a/server/sonar-db-dao/src/test/java/org/sonar/db/measure/LiveMeasureDaoTest.java +++ b/server/sonar-db-dao/src/test/java/org/sonar/db/measure/LiveMeasureDaoTest.java @@ -58,7 +58,7 @@ public class LiveMeasureDaoTest { private MetricDto metric; @Before - public void setUp() throws Exception { + public void setUp() { metric = db.measures().insertMetric(); } diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/permission/AuthorizationDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/permission/AuthorizationDaoTest.java index e023c37d88e..2b860045ac7 100644 --- a/server/sonar-db-dao/src/test/java/org/sonar/db/permission/AuthorizationDaoTest.java +++ b/server/sonar-db-dao/src/test/java/org/sonar/db/permission/AuthorizationDaoTest.java @@ -77,7 +77,7 @@ public class AuthorizationDaoTest { private String randomPermission = "p" + random.nextInt(); @Before - public void setUp() throws Exception { + public void setUp() { organization = db.organizations().insert(); user = db.users().insertUser(); group1 = db.users().insertGroup(organization, "group1"); diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/permission/GroupPermissionDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/permission/GroupPermissionDaoTest.java index 8f25059396d..93964365795 100644 --- a/server/sonar-db-dao/src/test/java/org/sonar/db/permission/GroupPermissionDaoTest.java +++ b/server/sonar-db-dao/src/test/java/org/sonar/db/permission/GroupPermissionDaoTest.java @@ -66,7 +66,7 @@ public class GroupPermissionDaoTest { private String defaultOrganizationUuid; @Before - public void setUp() throws Exception { + public void setUp() { defaultOrganizationUuid = db.getDefaultOrganization().getUuid(); } diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/permission/UserPermissionDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/permission/UserPermissionDaoTest.java index b78fa9cf962..0f8681d9763 100644 --- a/server/sonar-db-dao/src/test/java/org/sonar/db/permission/UserPermissionDaoTest.java +++ b/server/sonar-db-dao/src/test/java/org/sonar/db/permission/UserPermissionDaoTest.java @@ -745,13 +745,13 @@ public class UserPermissionDaoTest { assertThat(underTest.selectUserIdsByQuery(dbSession, query)).containsExactly(expectedUserIds.toArray(new Integer[0])); List<UserPermissionDto> currentPermissions = underTest.selectUserPermissionsByQuery(dbSession, query, expectedUserIds); assertThat(currentPermissions).hasSize(expectedPermissions.length); - List<Tuple> expectedPermissionsAsTuple = Arrays.stream(expectedPermissions) + Tuple[] expectedPermissionsAsTuple = Arrays.stream(expectedPermissions) .map(expectedPermission -> tuple(expectedPermission.getUserId(), expectedPermission.getPermission(), expectedPermission.getComponentId(), expectedPermission.getOrganizationUuid())) - .collect(Collectors.toList()); + .toArray(Tuple[]::new); assertThat(currentPermissions) .extracting(UserPermissionDto::getUserId, UserPermissionDto::getPermission, UserPermissionDto::getComponentId, UserPermissionDto::getOrganizationUuid) - .containsOnly(expectedPermissionsAsTuple.toArray(new Tuple[0])); + .containsOnly(expectedPermissionsAsTuple); // test method "countUsers()" long distinctUsers = stream(expectedPermissions).mapToLong(UserPermissionDto::getUserId).distinct().count(); diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/permission/template/PermissionTemplateDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/permission/template/PermissionTemplateDaoTest.java index 978855b5092..f29b64e4b38 100644 --- a/server/sonar-db-dao/src/test/java/org/sonar/db/permission/template/PermissionTemplateDaoTest.java +++ b/server/sonar-db-dao/src/test/java/org/sonar/db/permission/template/PermissionTemplateDaoTest.java @@ -65,7 +65,7 @@ public class PermissionTemplateDaoTest { private PermissionTemplateDao underTest = new PermissionTemplateDao(system2); @Before - public void setUp() throws Exception { + public void setUp() { when(system2.now()).thenReturn(NOW.getTime()); } diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeCommandsTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeCommandsTest.java index 01914170265..9b82297eab2 100644 --- a/server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeCommandsTest.java +++ b/server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeCommandsTest.java @@ -83,7 +83,7 @@ public class PurgeCommandsTest { } @Before - public void setUp() throws Exception { + public void setUp() { } diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeDaoTest.java index c3babddf4ea..c4591ff4cfe 100644 --- a/server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeDaoTest.java +++ b/server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeDaoTest.java @@ -237,7 +237,7 @@ public class PurgeDaoTest { dbSession.commit(); assertThat(db.select("select metric_id as \"METRIC\",analysis_uuid as \"ANALYSIS\" from project_measures")) - .extracting(t -> ((Long) t.get("METRIC")).intValue(), t -> (String) t.get("ANALYSIS")) + .extracting(t -> ((Long) t.get("METRIC")).intValue(), t -> t.get("ANALYSIS")) .containsOnly( tuple(metricWithHistory.getId(), lastAnalysis.getUuid()), tuple(metricWithoutHistory.getId(), lastAnalysis.getUuid()), diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeMapperTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeMapperTest.java index 8560f10c75d..d0d5461dc1a 100644 --- a/server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeMapperTest.java +++ b/server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeMapperTest.java @@ -41,7 +41,7 @@ public class PurgeMapperTest { private PurgeMapper purgeMapper; @Before - public void setUp() throws Exception { + public void setUp() { dbSession = db.getDbClient().openSession(false); purgeMapper = dbSession.getMapper(PurgeMapper.class); } diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeProfilerTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeProfilerTest.java index 48fdcfd856c..02ffbc73a81 100644 --- a/server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeProfilerTest.java +++ b/server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeProfilerTest.java @@ -80,7 +80,7 @@ public class PurgeProfilerTest { verify(logger).info(contains("bar: 5ms")); } - private class MockedClock extends PurgeProfiler.Clock { + private static class MockedClock extends PurgeProfiler.Clock { private long now = 0; @Override diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/qualityprofile/QProfileChangeDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/qualityprofile/QProfileChangeDaoTest.java index 4d26dcc207a..efeb18d0b40 100644 --- a/server/sonar-db-dao/src/test/java/org/sonar/db/qualityprofile/QProfileChangeDaoTest.java +++ b/server/sonar-db-dao/src/test/java/org/sonar/db/qualityprofile/QProfileChangeDaoTest.java @@ -33,7 +33,6 @@ import org.sonar.db.DbSession; import org.sonar.db.DbTester; import static java.util.Arrays.asList; -import static org.assertj.core.api.AssertionsForClassTypes.assertThat; import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat; public class QProfileChangeDaoTest { diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/user/GroupMembershipDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/user/GroupMembershipDaoTest.java index 72251e6be34..95fba0dad72 100644 --- a/server/sonar-db-dao/src/test/java/org/sonar/db/user/GroupMembershipDaoTest.java +++ b/server/sonar-db-dao/src/test/java/org/sonar/db/user/GroupMembershipDaoTest.java @@ -51,7 +51,7 @@ public class GroupMembershipDaoTest { private GroupMembershipDao underTest = db.getDbClient().groupMembershipDao(); @Before - public void setUp() throws Exception { + public void setUp() { organizationDto = db.organizations().insert(); user1 = db.users().insertUser(u -> u.setLogin("admin login").setName("Admin name").setEmail("admin@email.com")); user2 = db.users().insertUser(u -> u.setLogin("not.admin").setName("Not Admin").setEmail("Not Admin")); diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/user/UserDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/user/UserDaoTest.java index ca072da52a1..20e303303f1 100644 --- a/server/sonar-db-dao/src/test/java/org/sonar/db/user/UserDaoTest.java +++ b/server/sonar-db-dao/src/test/java/org/sonar/db/user/UserDaoTest.java @@ -320,7 +320,7 @@ public class UserDaoTest { @Test public void insert_user() { - Long date = DateUtils.parseDate("2014-06-20").getTime(); + long date = DateUtils.parseDate("2014-06-20").getTime(); UserDto userDto = new UserDto() .setId(1) diff --git a/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/SQDatabase.java b/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/SQDatabase.java index 4a4fd2eae79..677f3b4ab45 100644 --- a/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/SQDatabase.java +++ b/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/SQDatabase.java @@ -172,7 +172,7 @@ public class SQDatabase extends DefaultDatabase { new MigrationHistoryTableImpl(noopDatabase).start(); } - private class NoopDatabase implements Database { + private static class NoopDatabase implements Database { private final Dialect dialect; private final DataSource dataSource; diff --git a/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/TestDbImpl.java b/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/TestDbImpl.java index d984564bb08..7cd1e29e891 100644 --- a/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/TestDbImpl.java +++ b/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/TestDbImpl.java @@ -89,7 +89,7 @@ class TestDbImpl extends CoreTestDb { MyBatisConfExtension[] extensionArray = confExtensions.length == 0 ? null : confExtensions; if (schemaPath == null) { if (defaultSchemaBaseTestDb == null) { - defaultSchemaBaseTestDb = new TestDbImpl((String) null); + defaultSchemaBaseTestDb = new TestDbImpl(null); } if (extensionArray != null) { return defaultSchemaTestDbsWithExtensions.computeIfAbsent( diff --git a/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/notification/NotificationDbTester.java b/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/notification/NotificationDbTester.java index 4449bbaafc2..edcdba0316f 100644 --- a/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/notification/NotificationDbTester.java +++ b/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/notification/NotificationDbTester.java @@ -34,12 +34,10 @@ import static org.assertj.core.api.Assertions.assertThat; public class NotificationDbTester { private static final String PROP_NOTIFICATION_PREFIX = "notification"; - private final DbTester db; private final DbClient dbClient; private final DbSession dbSession; public NotificationDbTester(DbTester db) { - this.db = db; this.dbClient = db.getDbClient(); this.dbSession = db.getSession(); } diff --git a/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/user/GroupTesting.java b/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/user/GroupTesting.java index cfb6379e188..4e8c6e5219d 100644 --- a/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/user/GroupTesting.java +++ b/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/user/GroupTesting.java @@ -32,13 +32,12 @@ public class GroupTesting { } public static GroupDto newGroupDto() { - GroupDto group = new GroupDto() + return new GroupDto() .setId(nextInt()) .setOrganizationUuid(randomAlphanumeric(40)) .setName(randomAlphanumeric(255)) .setDescription(randomAlphanumeric(200)) .setCreatedAt(new Date(nextLong())) .setUpdatedAt(new Date(nextLong())); - return group; } } |