Fix 'Boxed value is unboxed and then immediately reboxed' warnings

As reported by FindBugs

Change-Id: I8c1746d2a813362f13a35737ffac1c2f161af197
This commit is contained in:
David Pursehouse
2015-03-13 14:48:37 +09:00
parent b4ea0fe5aa
commit 67e35278a9
8 changed files with 16 additions and 16 deletions

View File

@@ -187,7 +187,7 @@ public abstract class AbstractPushForReview extends AbstractDaemonTest {
LabelInfo cr = ci.labels.get("Code-Review");
assertThat(cr.all).hasSize(1);
assertThat(cr.all.get(0).name).isEqualTo("Administrator");
assertThat(cr.all.get(0).value.intValue()).is(1);
assertThat(cr.all.get(0).value).is(1);
PushOneCommit push =
pushFactory.create(db, admin.getIdent(), PushOneCommit.SUBJECT,
@@ -198,7 +198,7 @@ public abstract class AbstractPushForReview extends AbstractDaemonTest {
cr = ci.labels.get("Code-Review");
assertThat(cr.all).hasSize(1);
assertThat(cr.all.get(0).name).isEqualTo("Administrator");
assertThat(cr.all.get(0).value.intValue()).is(2);
assertThat(cr.all.get(0).value).is(2);
}
@Test

View File

@@ -317,7 +317,7 @@ public abstract class AbstractSubmit extends AbstractDaemonTest {
ChangeInfo c = getChange(changeId, DETAILED_LABELS);
LabelInfo cr = c.labels.get("Code-Review");
assertThat(cr.all).hasSize(1);
assertThat(cr.all.get(0).value.intValue()).isEqualTo(2);
assertThat(cr.all.get(0).value).isEqualTo(2);
assertThat(new Account.Id(cr.all.get(0)._accountId)).isEqualTo(admin.getId());
}

View File

@@ -42,7 +42,7 @@ public class CacheOperationsIT extends AbstractDaemonTest {
public void flushAll() throws Exception {
RestResponse r = adminSession.get("/config/server/caches/project_list");
CacheInfo cacheInfo = newGson().fromJson(r.getReader(), CacheInfo.class);
assertThat(cacheInfo.entries.mem.longValue()).isGreaterThan((long) 0);
assertThat(cacheInfo.entries.mem).isGreaterThan((long) 0);
r = adminSession.post("/config/server/caches/", new PostCaches.Input(FLUSH_ALL));
assertThat(r.getStatusCode()).isEqualTo(HttpStatus.SC_OK);
@@ -71,11 +71,11 @@ public class CacheOperationsIT extends AbstractDaemonTest {
public void flush() throws Exception {
RestResponse r = adminSession.get("/config/server/caches/project_list");
CacheInfo cacheInfo = newGson().fromJson(r.getReader(), CacheInfo.class);
assertThat(cacheInfo.entries.mem.longValue()).isGreaterThan((long)0);
assertThat(cacheInfo.entries.mem).isGreaterThan((long)0);
r = adminSession.get("/config/server/caches/projects");
cacheInfo = newGson().fromJson(r.getReader(), CacheInfo.class);
assertThat(cacheInfo.entries.mem.longValue()).isGreaterThan((long)1);
assertThat(cacheInfo.entries.mem).isGreaterThan((long)1);
r = adminSession.post("/config/server/caches/",
new PostCaches.Input(FLUSH, Arrays.asList("accounts", "project_list")));
@@ -88,7 +88,7 @@ public class CacheOperationsIT extends AbstractDaemonTest {
r = adminSession.get("/config/server/caches/projects");
cacheInfo = newGson().fromJson(r.getReader(), CacheInfo.class);
assertThat(cacheInfo.entries.mem.longValue()).isGreaterThan((long)1);
assertThat(cacheInfo.entries.mem).isGreaterThan((long)1);
}
@Test
@@ -109,7 +109,7 @@ public class CacheOperationsIT extends AbstractDaemonTest {
public void flush_UnprocessableEntity() throws Exception {
RestResponse r = adminSession.get("/config/server/caches/projects");
CacheInfo cacheInfo = newGson().fromJson(r.getReader(), CacheInfo.class);
assertThat(cacheInfo.entries.mem.longValue()).isGreaterThan((long)0);
assertThat(cacheInfo.entries.mem).isGreaterThan((long)0);
r = adminSession.post("/config/server/caches/",
new PostCaches.Input(FLUSH, Arrays.asList("projects", "unprocessable")));
@@ -118,7 +118,7 @@ public class CacheOperationsIT extends AbstractDaemonTest {
r = adminSession.get("/config/server/caches/projects");
cacheInfo = newGson().fromJson(r.getReader(), CacheInfo.class);
assertThat(cacheInfo.entries.mem.longValue()).isGreaterThan((long)0);
assertThat(cacheInfo.entries.mem).isGreaterThan((long)0);
}
@Test

View File

@@ -38,7 +38,7 @@ public class FlushCacheIT extends AbstractDaemonTest {
public void flushCache() throws Exception {
RestResponse r = adminSession.get("/config/server/caches/groups");
CacheInfo result = newGson().fromJson(r.getReader(), CacheInfo.class);
assertThat(result.entries.mem.longValue()).isGreaterThan((long)0);
assertThat(result.entries.mem).isGreaterThan((long)0);
r = adminSession.post("/config/server/caches/groups/flush");
assertThat(r.getStatusCode()).isEqualTo(HttpStatus.SC_OK);

View File

@@ -34,7 +34,7 @@ public class GetCacheIT extends AbstractDaemonTest {
assertThat(result.name).isEqualTo("accounts");
assertThat(result.type).isEqualTo(CacheType.MEM);
assertThat(result.entries.mem.longValue()).isEqualTo(1);
assertThat(result.entries.mem).isEqualTo(1);
assertThat(result.averageGet).isNotNull();
assertThat(result.averageGet).endsWith("s");
assertThat(result.entries.disk).isNull();
@@ -47,7 +47,7 @@ public class GetCacheIT extends AbstractDaemonTest {
r = adminSession.get("/config/server/caches/accounts");
assertThat(r.getStatusCode()).isEqualTo(HttpStatus.SC_OK);
result = newGson().fromJson(r.getReader(), CacheInfo.class);
assertThat(result.entries.mem.longValue()).isEqualTo(2);
assertThat(result.entries.mem).isEqualTo(2);
}
@Test

View File

@@ -45,7 +45,7 @@ public class ListCachesIT extends AbstractDaemonTest {
assertThat(result).containsKey("accounts");
CacheInfo accountsCacheInfo = result.get("accounts");
assertThat(accountsCacheInfo.type).isEqualTo(CacheType.MEM);
assertThat(accountsCacheInfo.entries.mem.longValue()).isEqualTo(1);
assertThat(accountsCacheInfo.entries.mem).isEqualTo(1);
assertThat(accountsCacheInfo.averageGet).isNotNull();
assertThat(accountsCacheInfo.averageGet).endsWith("s");
assertThat(accountsCacheInfo.entries.disk).isNull();
@@ -59,7 +59,7 @@ public class ListCachesIT extends AbstractDaemonTest {
assertThat(r.getStatusCode()).isEqualTo(HttpStatus.SC_OK);
result = newGson().fromJson(r.getReader(),
new TypeToken<Map<String, CacheInfo>>() {}.getType());
assertThat(result.get("accounts").entries.mem.longValue()).isEqualTo(2);
assertThat(result.get("accounts").entries.mem).isEqualTo(2);
}
@Test

View File

@@ -178,7 +178,7 @@ public class GetRelatedIT extends AbstractDaemonTest {
.isEqualTo(c3.getChangeId());
assertThat(related.get(1).changeId).named("related to " + c2.getChangeId())
.isEqualTo(c2.getChangeId());
assertThat(related.get(1)._revisionNumber.intValue()).named(
assertThat(related.get(1)._revisionNumber).named(
"has edit revision number").isEqualTo(0);
assertThat(related.get(1).commit.commit).named(
"has edit revision " + editRev).isEqualTo(editRev);

View File

@@ -312,6 +312,6 @@ public class LabelTypeIT extends AbstractDaemonTest {
assertThat((int) cr.defaultValue).isEqualTo(-1);
assertThat(cr.all).hasSize(1);
assertThat(cr.all.get(0).name).isEqualTo("Administrator");
assertThat(cr.all.get(0).value.intValue()).isEqualTo(expected);
assertThat(cr.all.get(0).value).isEqualTo(expected);
}
}