Fix TopicPartitionInfoTest

This commit is contained in:
ViacheslavKlimov 2025-03-25 17:54:20 +02:00
parent 92466630b1
commit 6678ec2e06

View File

@ -18,12 +18,16 @@ package org.thingsboard.server.common.msg.queue;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.id.TenantId;
import java.util.UUID;
import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
public class TopicPartitionInfoTest { public class TopicPartitionInfoTest {
private final TenantId tenantId = TenantId.fromUUID(UUID.randomUUID());
@Test @Test
public void givenTopicPartitionInfo_whenEquals_thenTrue() { public void givenTopicPartitionInfo_whenEquals_thenTrue() {
@ -52,13 +56,13 @@ public class TopicPartitionInfoTest {
assertThat(TopicPartitionInfo.builder() assertThat(TopicPartitionInfo.builder()
.topic("tb_core") .topic("tb_core")
.tenantId(TenantId.SYS_TENANT_ID) .tenantId(tenantId)
.partition(4) .partition(4)
.myPartition(true) //will ignored on equals .myPartition(true) //will ignored on equals
.build() .build()
, is(TopicPartitionInfo.builder() , is(TopicPartitionInfo.builder()
.topic("tb_core") .topic("tb_core")
.tenantId(TenantId.SYS_TENANT_ID) .tenantId(tenantId)
.partition(4) .partition(4)
.myPartition(true) //will ignored on equals .myPartition(true) //will ignored on equals
.build())); .build()));
@ -109,7 +113,7 @@ public class TopicPartitionInfoTest {
assertThat(TopicPartitionInfo.builder() assertThat(TopicPartitionInfo.builder()
.topic("tb_core") .topic("tb_core")
.tenantId(TenantId.SYS_TENANT_ID) .tenantId(tenantId)
.partition(4) .partition(4)
.myPartition(true) //will ignored on equals .myPartition(true) //will ignored on equals
.build() .build()
@ -117,7 +121,7 @@ public class TopicPartitionInfoTest {
assertThat(TopicPartitionInfo.builder() assertThat(TopicPartitionInfo.builder()
.topic("tb_core") .topic("tb_core")
.tenantId(TenantId.SYS_TENANT_ID) .tenantId(tenantId)
.partition(4) .partition(4)
.myPartition(false) //will ignored on equals .myPartition(false) //will ignored on equals
.build() .build()