test_class.declarator: generator = new ConditionValueBetweenOperatorGenerator()
test_class.modifier: private final
test_class.original_string: private final ConditionValueBetweenOperatorGenerator generator = new ConditionValueBetweenOperatorGenerator();
test_class.type: ConditionValueBetweenOperatorGenerator
test_class.var_name: generator
test_class.declarator: column = new Column("id", "tbl")
test_class.modifier: private final
test_class.original_string: private final Column column = new Column("id", "tbl");
test_class.type: Column
test_class.var_name: column
test_class.file: shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/test/java/org/apache/shardingsphere/sharding/route/engine/condition/generator/impl/ConditionValueBetweenOperatorGeneratorTest.java
test_class.identifier: ConditionValueBetweenOperatorGeneratorTest
test_case.body: @SuppressWarnings("unchecked")
      @Test
      public void assertGenerateConditionValueWithDifferentNumericType() {
          int between = 3;
          long and = 3147483647L;
          ExpressionSegment betweenSegment = new LiteralExpressionSegment(0, 0, between);
          ExpressionSegment andSegment = new LiteralExpressionSegment(0, 0, and);
          BetweenExpression value = new BetweenExpression(0, 0, null, betweenSegment, andSegment, false);
          Optional<RouteValue> routeValue = generator.generate(value, column, new LinkedList<>());
          assertTrue(routeValue.isPresent());
          RangeRouteValue<Comparable<?>> rangeRouteValue = (RangeRouteValue<Comparable<?>>) routeValue.get();
          assertThat(rangeRouteValue.getColumnName(), is(column.getName()));
          assertThat(rangeRouteValue.getTableName(), is(column.getTableName()));
          assertTrue(SafeNumberOperationUtils.safeContains(rangeRouteValue.getValueRange(), between));
          assertTrue(SafeNumberOperationUtils.safeContains(rangeRouteValue.getValueRange(), and));
      }
test_case.class_method_signature: ConditionValueBetweenOperatorGeneratorTest.assertGenerateConditionValueWithDifferentNumericType()
test_case.full_signature: @SuppressWarnings("unchecked") @Test public void assertGenerateConditionValueWithDifferentNumericType()
test_case.identifier: assertGenerateConditionValueWithDifferentNumericType
test_case.invocations: generate assertTrue isPresent get assertThat getColumnName is getName assertThat getTableName is getTableName assertTrue safeContains getValueRange assertTrue safeContains getValueRange
test_case.modifiers: @SuppressWarnings("unchecked") @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void assertGenerateConditionValueWithDifferentNumericType()
focal_class.file: shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/condition/generator/impl/ConditionValueBetweenOperatorGenerator.java
focal_class.identifier: ConditionValueBetweenOperatorGenerator
focal_class.interfaces: implements ConditionValueGenerator<BetweenExpression>
focal_class.class_method_signature: ConditionValueBetweenOperatorGenerator.generate(final BetweenExpression predicate, final Column column, final List<Object> parameters)
focal_class.full_signature: @Override public Optional<RouteValue> generate(final BetweenExpression predicate, final Column column, final List<Object> parameters)
focal_class.identifier: generate
focal_class.modifiers: @Override public
focal_class.parameters: (final BetweenExpression predicate, final Column column, final List<Object> parameters)
focal_class.return: Optional<RouteValue>
focal_class.signature: Optional<RouteValue> generate(final BetweenExpression predicate, final Column column, final List<Object> parameters)
focal_method.body: @Override
      public Optional<RouteValue> generate(final BetweenExpression predicate, final Column column, final List<Object> parameters) {
          Optional<Comparable<?>> betweenRouteValue = new ConditionValue(predicate.getBetweenExpr(), parameters).getValue();
          Optional<Comparable<?>> andRouteValue = new ConditionValue(predicate.getAndExpr(), parameters).getValue();
          if (betweenRouteValue.isPresent() && andRouteValue.isPresent()) {
              return Optional.of(new RangeRouteValue<>(column.getName(), column.getTableName(), SafeNumberOperationUtils.safeClosed(betweenRouteValue.get(), andRouteValue.get())));
          }
          Date date = new SPITimeService().getTime();
          if (!betweenRouteValue.isPresent() && ExpressionConditionUtils.isNowExpression(predicate.getBetweenExpr())) {
              betweenRouteValue = Optional.of(date);
          }
          if (!andRouteValue.isPresent() && ExpressionConditionUtils.isNowExpression(predicate.getAndExpr())) {
              andRouteValue = Optional.of(date);
          }
          return betweenRouteValue.isPresent() && andRouteValue.isPresent()
                  ? Optional.of(new RangeRouteValue<>(column.getName(), column.getTableName(), Range.closed(betweenRouteValue.get(), andRouteValue.get())))
                  : Optional.empty();
      }
focal_method.class_method_signature: ConditionValueBetweenOperatorGenerator.generate(final BetweenExpression predicate, final Column column, final List<Object> parameters)
focal_method.full_signature: @Override public Optional<RouteValue> generate(final BetweenExpression predicate, final Column column, final List<Object> parameters)
focal_method.identifier: generate
focal_method.invocations: getValue getBetweenExpr getValue getAndExpr isPresent isPresent of getName getTableName safeClosed get get getTime isPresent isNowExpression getBetweenExpr of isPresent isNowExpression getAndExpr of isPresent isPresent of getName getTableName closed get get empty
focal_method.modifiers: @Override public
focal_method.parameters: (final BetweenExpression predicate, final Column column, final List<Object> parameters)
focal_method.return: Optional<RouteValue>
focal_method.signature: Optional<RouteValue> generate(final BetweenExpression predicate, final Column column, final List<Object> parameters)