Upgrade AssertJ to version 3.24.2

patch by Shylaja Kokoori; reviewed by Stefan Miklosovic and Brandon Williams for CASSANDRA-17951
This commit is contained in:
Stefan Miklosovic 2023-07-27 13:30:31 +02:00
parent c6f0521406
commit e4414cc268
No known key found for this signature in database
GPG Key ID: 32F35CB2F546D93E
4 changed files with 12 additions and 9 deletions

View File

@ -1047,17 +1047,19 @@
<artifactId>j2objc-annotations</artifactId>
<version>1.3</version>
</dependency>
<!-- adding this dependency is necessary for assertj. When updating assertj, need to also update the version of
this that the new assertj's `assertj-parent-pom` depends on. -->
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit-bom</artifactId>
<version>5.6.0</version>
<version>5.9.1</version>
<type>pom</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.15.0</version>
<version>3.24.2</version>
<scope>test</scope>
</dependency>
<dependency>

View File

@ -532,6 +532,6 @@ public class SSTableIdGenerationTest extends TestBaseImpl
SimpleQueryResult result = instance.executeInternalWithResult(format("SELECT * FROM %s.%s", ks, tableName));
Object[][] rows = result.toObjectArrays();
assertThat(rows).withFailMessage("Invalid results for %s.%s - should have %d rows but has %d: \n%s", ks, tableName, expectedNumber,
rows.length, result.toString()).hasSize(expectedNumber);
rows.length, result.toString()).hasNumberOfRows(expectedNumber);
}
}

View File

@ -29,6 +29,7 @@ import org.apache.cassandra.distributed.api.Row;
import org.apache.cassandra.distributed.api.SimpleQueryResult;
import org.apache.cassandra.tools.nodetool.formatter.TableBuilder;
import org.assertj.core.api.Assertions;
import org.assertj.core.data.Index;
public class QueryResultUtil
{
@ -201,27 +202,27 @@ public class QueryResultUtil
public SimpleQueryResultAssertHelper isEqualTo(Object... values)
{
Assertions.assertThat(qr.toObjectArrays())
.hasSize(1)
.contains(values);
.hasNumberOfRows(1)
.contains(values, Index.atIndex(0));
return this;
}
public SimpleQueryResultAssertHelper hasSize(int size)
{
Assertions.assertThat(qr.toObjectArrays()).hasSize(size);
Assertions.assertThat(qr.toObjectArrays()).hasNumberOfRows(size);
return this;
}
public SimpleQueryResultAssertHelper hasSizeGreaterThan(int size)
{
Assertions.assertThat(qr.toObjectArrays()).hasSizeGreaterThan(size);
Assertions.assertThat((qr.toObjectArrays()).length).isGreaterThan(size);
return this;
}
public void isEmpty()
{
int size = Iterators.size(qr);
Assertions.assertThat(size).describedAs("QueryResult is not empty").isEqualTo(0);
Assertions.assertThat(size).describedAs("QueryResult is not empty").isZero();
}
}

View File

@ -712,7 +712,7 @@ public class RepairJobTest
false,
PreviewKind.ALL));
assertThat(tasks.values()).areAllInstanceOf(AsymmetricRemoteSyncTask.class);
SyncTaskListAssert.assertThat(tasks.values()).areAllInstanceOf(AsymmetricRemoteSyncTask.class);
// addr1 streams range1 from addr3:
assertThat(tasks.get(pair(addr1, addr3)).rangesToSync).contains(RANGE_1);