Browse Source

Fix compilation error: use effectively final variables in lambda expressions

Variables reassigned in a loop cannot be captured in lambda expressions.
Introduce finalSavedDevice and finalTenantProfile as effectively final copies
before use in Awaitility.await() lambdas.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
pull/15200/head
Sergey Matvienko 7 months ago
parent
commit
26acf60768
  1. 6
      application/src/test/java/org/thingsboard/server/controller/AuditLogControllerTest.java

6
application/src/test/java/org/thingsboard/server/controller/AuditLogControllerTest.java

@ -170,8 +170,9 @@ public class AuditLogControllerTest extends AbstractControllerTest {
savedDevice = doPost("/api/device", savedDevice, Device.class);
}
Device finalSavedDevice = savedDevice;
Awaitility.await().atMost(TIMEOUT, TimeUnit.SECONDS).untilAsserted(() ->
assertThat(getAuditLogs(SMALL_PAGE_SIZE, "/api/audit/logs/entity/DEVICE/" + savedDevice.getId().getId() + "?")).hasSize(11 + 1));
assertThat(getAuditLogs(SMALL_PAGE_SIZE, "/api/audit/logs/entity/DEVICE/" + finalSavedDevice.getId().getId() + "?")).hasSize(11 + 1));
}
@Test
@ -187,8 +188,9 @@ public class AuditLogControllerTest extends AbstractControllerTest {
tenantProfile.setName(tenantProfile.getName() + "(old)");
tenantProfile = doPost("/api/tenantProfile", tenantProfile, TenantProfile.class);
TenantProfile finalTenantProfile = tenantProfile;
Awaitility.await().atMost(TIMEOUT, TimeUnit.SECONDS).untilAsserted(() ->
assertThat(getAuditLogs(SMALL_PAGE_SIZE, "/api/audit/logs/entity/" + tenantProfile.getId().getEntityType() + "/" + tenantProfile.getId().getId() + "?"))
assertThat(getAuditLogs(SMALL_PAGE_SIZE, "/api/audit/logs/entity/" + finalTenantProfile.getId().getEntityType() + "/" + finalTenantProfile.getId().getId() + "?"))
.as("Audit logs count by Tenant Profile entity").hasSize(2));
//cleanup

Loading…
Cancel
Save