Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@
import com.google.common.collect.ImmutableSet;
import nl.jqno.equalsverifier.EqualsVerifier;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;

import java.math.BigInteger;

Expand All @@ -31,14 +28,10 @@
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;

@RunWith(MockitoJUnitRunner.class)
public class TestNormalizedRange
{
private static final BigInteger START = BigInteger.ZERO;

@Mock
DriverNode mockNode;

@Test
public void testMutateStart()
{
Expand Down Expand Up @@ -352,6 +345,6 @@ private BigInteger bi(long token)

private VnodeRepairState withVnode(long start, long end, long startedAt, long finishedAt)
{
return new VnodeRepairState(new LongTokenRange(start, end), ImmutableSet.of(mockNode), startedAt, finishedAt);
return new VnodeRepairState(new LongTokenRange(start, end), ImmutableSet.of(), startedAt, finishedAt);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,20 @@
import com.google.common.collect.Sets;
import nl.jqno.equalsverifier.EqualsVerifier;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;

import java.util.Set;

import static org.assertj.core.api.Assertions.assertThat;

@RunWith(MockitoJUnitRunner.class)
public class TestRepairEntry
{
@Mock
private DriverNode mockNode;

@Test
public void testGetters()
{
LongTokenRange expectedLongTokenRange = new LongTokenRange(0, 1);
long expectedStartedAt = 5;
long expectedFinishedAt = expectedStartedAt + 5;
Set<DriverNode> expectedParticipants = Sets.newHashSet(mockNode);
Set<DriverNode> expectedParticipants = Sets.newHashSet();
RepairStatus expectedStatus = RepairStatus.SUCCESS;

RepairEntry repairEntry = new RepairEntry(expectedLongTokenRange, expectedStartedAt, expectedFinishedAt, expectedParticipants, expectedStatus.toString());
Expand All @@ -54,8 +47,8 @@ public void testGetters()
@Test
public void testRepairEntriesAreEqual()
{
RepairEntry repairEntry = new RepairEntry(new LongTokenRange(0, 1), 5, 5, Sets.newHashSet(mockNode), "SUCCESS");
RepairEntry repairEntry2 = new RepairEntry(new LongTokenRange(0, 1), 5, 5, Sets.newHashSet(mockNode), "SUCCESS");
RepairEntry repairEntry = new RepairEntry(new LongTokenRange(0, 1), 5, 5, Sets.newHashSet(), "SUCCESS");
RepairEntry repairEntry2 = new RepairEntry(new LongTokenRange(0, 1), 5, 5, Sets.newHashSet(), "SUCCESS");

assertThat(repairEntry).isEqualTo(repairEntry2);
assertThat(repairEntry.hashCode()).isEqualTo(repairEntry2.hashCode());
Expand All @@ -64,34 +57,34 @@ public void testRepairEntriesAreEqual()
@Test
public void testRepairEntriesWithDifferentRangeAreNotEqual()
{
RepairEntry repairEntry = new RepairEntry(new LongTokenRange(0, 1), 5, 5, Sets.newHashSet(mockNode), "SUCCESS");
RepairEntry repairEntry2 = new RepairEntry(new LongTokenRange(1, 2), 5, 5, Sets.newHashSet(mockNode), "SUCCESS");
RepairEntry repairEntry = new RepairEntry(new LongTokenRange(0, 1), 5, 5, Sets.newHashSet(), "SUCCESS");
RepairEntry repairEntry2 = new RepairEntry(new LongTokenRange(1, 2), 5, 5, Sets.newHashSet(), "SUCCESS");

assertThat(repairEntry).isNotEqualTo(repairEntry2);
}

@Test
public void testRepairEntriesWithDifferentStartedAtAreNotEqual()
{
RepairEntry repairEntry = new RepairEntry(new LongTokenRange(0, 1), 5, 7, Sets.newHashSet(mockNode), "SUCCESS");
RepairEntry repairEntry2 = new RepairEntry(new LongTokenRange(0, 1), 6, 7, Sets.newHashSet(mockNode), "SUCCESS");
RepairEntry repairEntry = new RepairEntry(new LongTokenRange(0, 1), 5, 7, Sets.newHashSet(), "SUCCESS");
RepairEntry repairEntry2 = new RepairEntry(new LongTokenRange(0, 1), 6, 7, Sets.newHashSet(), "SUCCESS");

assertThat(repairEntry).isNotEqualTo(repairEntry2);
}

@Test
public void testRepairEntriesWithDifferentFinishedAtAreNotEqual()
{
RepairEntry repairEntry = new RepairEntry(new LongTokenRange(0, 1), 5, 6, Sets.newHashSet(mockNode), "SUCCESS");
RepairEntry repairEntry2 = new RepairEntry(new LongTokenRange(0, 1), 5, 7, Sets.newHashSet(mockNode), "SUCCESS");
RepairEntry repairEntry = new RepairEntry(new LongTokenRange(0, 1), 5, 6, Sets.newHashSet(), "SUCCESS");
RepairEntry repairEntry2 = new RepairEntry(new LongTokenRange(0, 1), 5, 7, Sets.newHashSet(), "SUCCESS");

assertThat(repairEntry).isNotEqualTo(repairEntry2);
}

@Test
public void testRepairEntriesWithDifferentParticipantsAreNotEqual()
{
RepairEntry repairEntry = new RepairEntry(new LongTokenRange(0, 1), 5, 5, Sets.newHashSet(mockNode), "SUCCESS");
RepairEntry repairEntry = new RepairEntry(new LongTokenRange(0, 1), 5, 5, Sets.newHashSet(new DriverNode(null)), "SUCCESS");
RepairEntry repairEntry2 = new RepairEntry(new LongTokenRange(0, 1), 5, 5, Sets.newHashSet(), "SUCCESS");

assertThat(repairEntry).isNotEqualTo(repairEntry2);
Expand All @@ -100,8 +93,8 @@ public void testRepairEntriesWithDifferentParticipantsAreNotEqual()
@Test
public void testRepairEntriesWithDifferentStatusAreNotEqual()
{
RepairEntry repairEntry = new RepairEntry(new LongTokenRange(0, 1), 5, 5, Sets.newHashSet(mockNode), "SUCCESS");
RepairEntry repairEntry2 = new RepairEntry(new LongTokenRange(0, 1), 5, 5, Sets.newHashSet(mockNode), "FAILED");
RepairEntry repairEntry = new RepairEntry(new LongTokenRange(0, 1), 5, 5, Sets.newHashSet(), "SUCCESS");
RepairEntry repairEntry2 = new RepairEntry(new LongTokenRange(0, 1), 5, 5, Sets.newHashSet(), "FAILED");

assertThat(repairEntry).isNotEqualTo(repairEntry2);
}
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@
<junit.jupiter.junit-jupiter.version>6.0.1</junit.jupiter.junit-jupiter.version>
<org.apache.commons.io.version>2.21.0</org.apache.commons.io.version>
<org.apache.commons.commons-compress.version>1.28.0</org.apache.commons.commons-compress.version>
<equalsverifier.version>4.2.2</equalsverifier.version>
<equalsverifier.version>4.2.3</equalsverifier.version>
<jcip.version>1.0</jcip.version>
<testcontainers.version>1.21.3</testcontainers.version>
<org.bouncycastle.bcpkix-jdk18on.version>1.82</org.bouncycastle.bcpkix-jdk18on.version>
Expand All @@ -169,7 +169,7 @@
<org.apache.maven.plugins.maven-failsafe-plugin.version>3.5.4</org.apache.maven.plugins.maven-failsafe-plugin.version>
<org.apache.maven.plugins.maven-gpg-plugin.version>3.2.8</org.apache.maven.plugins.maven-gpg-plugin.version>
<org.apache.maven.plugins.maven-install-plugin.version>3.1.4</org.apache.maven.plugins.maven-install-plugin.version>
<org.apache.maven.plugins-maven-jar-plugin.version>3.4.2</org.apache.maven.plugins-maven-jar-plugin.version>
<org.apache.maven.plugins-maven-jar-plugin.version>3.5.0</org.apache.maven.plugins-maven-jar-plugin.version>
<org.apache.maven.plugins.maven-javadoc-plugin.version>3.12.0</org.apache.maven.plugins.maven-javadoc-plugin.version>
<org.apache.maven.plugins-maven-pmd-plugin.version>3.28.0</org.apache.maven.plugins-maven-pmd-plugin.version>
<org.apache.maven.plugins.maven-release-plugin.version>3.2.0</org.apache.maven.plugins.maven-release-plugin.version>
Expand Down
Loading