Skip to content

Commit

Permalink
Use assertDoesNotThrow in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
51-code committed Jun 10, 2024
1 parent f518d5f commit e5e0d91
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/test/java/SortOperationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
import org.apache.spark.sql.catalyst.encoders.RowEncoder;
import org.apache.spark.sql.execution.streaming.MemoryStream;
import org.apache.spark.sql.streaming.StreamingQuery;
import org.apache.spark.sql.streaming.StreamingQueryException;
import org.apache.spark.sql.types.DataTypes;
import org.apache.spark.sql.types.MetadataBuilder;
import org.apache.spark.sql.types.StructField;
Expand Down Expand Up @@ -85,7 +84,7 @@ public class SortOperationTest {
);

@Test
public void testTwoSortByClauses() throws StreamingQueryException {
public void testTwoSortByClauses() {
SparkSession sparkSession = SparkSession.builder().master("local[*]").getOrCreate();
SQLContext sqlContext = sparkSession.sqlContext();

Expand Down Expand Up @@ -123,7 +122,7 @@ public void testTwoSortByClauses() throws StreamingQueryException {
}

@Test
public void testTwoSortByClausesDescending() throws StreamingQueryException {
public void testTwoSortByClausesDescending() {
SparkSession sparkSession = SparkSession.builder().master("local[*]").getOrCreate();
SQLContext sqlContext = sparkSession.sqlContext();

Expand Down Expand Up @@ -161,7 +160,7 @@ public void testTwoSortByClausesDescending() throws StreamingQueryException {
}

@Test
public void testTwoSortByClauseDescending_IP() throws StreamingQueryException {
public void testTwoSortByClauseDescending_IP() {
SparkSession sparkSession = SparkSession.builder().master("local[*]").getOrCreate();
SQLContext sqlContext = sparkSession.sqlContext();

Expand Down Expand Up @@ -202,7 +201,7 @@ public void testTwoSortByClauseDescending_IP() throws StreamingQueryException {
}

@Test
public void testThreeSortByClauses() throws StreamingQueryException {
public void testThreeSortByClauses() {
SparkSession sparkSession = SparkSession.builder().master("local[*]").getOrCreate();
SQLContext sqlContext = sparkSession.sqlContext();

Expand Down Expand Up @@ -251,7 +250,7 @@ public void testThreeSortByClauses() throws StreamingQueryException {
Assertions.assertEquals(20, host.size());
}

private void createData(BatchCollect batchCollect, SQLContext sqlContext) throws StreamingQueryException {
private void createData(BatchCollect batchCollect, SQLContext sqlContext) {
ExpressionEncoder<Row> encoder = RowEncoder.apply(testSchema);
MemoryStream<Row> rowMemoryStream =
new MemoryStream<>(1, sqlContext, encoder);
Expand Down Expand Up @@ -296,7 +295,7 @@ private void createData(BatchCollect batchCollect, SQLContext sqlContext) throws
// 4 runs only
streamingQuery.processAllAvailable();
streamingQuery.stop();
streamingQuery.awaitTermination();
Assertions.assertDoesNotThrow(() -> streamingQuery.awaitTermination());
}
}
}
Expand Down

0 comments on commit e5e0d91

Please sign in to comment.