Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test for Sort.getOrder and Sort.create #1124

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 18 additions & 0 deletions core/src/test/java/tech/tablesaw/SortTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import tech.tablesaw.analytic.AnalyticQuery;
import tech.tablesaw.api.DoubleColumn;
import tech.tablesaw.api.IntColumn;
import tech.tablesaw.api.Table;
import tech.tablesaw.sorting.Sort;

Expand Down Expand Up @@ -149,4 +151,20 @@ public void createSortInvalidPrefixColumnDoesNotExist() {

assertEquals("Unrecognized Column: '>col2'", thrown.getMessage());
}

@Test
public void testGetOrderAndCreate0() throws Exception {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this test name should be more descriptive. what behavior is being tested? i.e. why do you expect an IllegalStateException to be thrown?

assertThrows(IllegalStateException.class, () -> {
Table table = Table.create("table1", IntColumn.create(" ales"));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you mean for there to be a space in " ales"? if so, why?

AnalyticQuery.query()
.from(table)
.partitionBy("product", "region")
.orderBy("sales")
.rowsBetween()
.unboundedPreceding()
.andUnBoundedFollowing()
.sum("sales").as("sumSales")
.build();
});
}
}