Skip to content

Commit

Permalink
Refactor WhereSegmentBinderTest (apache#30874)
Browse files Browse the repository at this point in the history
  • Loading branch information
yx9o authored Apr 13, 2024
1 parent 8f9516f commit 136ca67
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@
import org.apache.shardingsphere.infra.binder.statement.SQLStatementBinderContext;
import org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.ExpressionSegment;
import org.apache.shardingsphere.sql.parser.sql.common.segment.dml.predicate.WhereSegment;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

import java.util.HashMap;
import java.util.Map;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.mockito.Mockito.mock;

class WhereSegmentBinderTest {
Expand All @@ -38,8 +39,8 @@ void assertBind() {
Map<String, TableSegmentBinderContext> tableBinderContexts = new HashMap<>();
Map<String, TableSegmentBinderContext> outerTableBinderContexts = new HashMap<>();
WhereSegment actualWhereSegment = WhereSegmentBinder.bind(expectedWhereSegment, sqlStatementBinderContext, tableBinderContexts, outerTableBinderContexts);
Assertions.assertEquals(expectedWhereSegment.getStopIndex(), actualWhereSegment.getStopIndex());
Assertions.assertEquals(expectedWhereSegment.getStartIndex(), actualWhereSegment.getStartIndex());
Assertions.assertEquals(expectedWhereSegment.getExpr(), actualWhereSegment.getExpr());
assertThat(actualWhereSegment.getStopIndex(), is(expectedWhereSegment.getStopIndex()));
assertThat(actualWhereSegment.getStartIndex(), is(expectedWhereSegment.getStartIndex()));
assertThat(actualWhereSegment.getExpr(), is(expectedWhereSegment.getExpr()));
}
}

0 comments on commit 136ca67

Please sign in to comment.