    @Test
    public void testEvaluateFunctionThrowsExceptionTranslated() {
        final ExpressionNumberKind kind = ExpressionNumberKind.DOUBLE;

        final FunctionExpressionName name = FunctionExpressionName.with("test123");

        this.evaluateAndCheck(
                BasicExpressionEvaluationContext.with(
                                kind,
                                (n) -> {
                                    return new FakeExpressionFunction<>() {
                                        @Override
                                        public Object apply(final List<Object> objects,
                                                            final ExpressionEvaluationContext context) {
                                            throw new UnsupportedOperationException("Thrown123");
                                        }

                                        @Override
                                        public FunctionExpressionName name() {
                                            return name;
                                        }

                                        @Override
                                        public List<ExpressionFunctionParameter<?>> parameters() {
                                            return ExpressionFunctionParameter.EMPTY;
                                        }

                                        public Set<ExpressionFunctionKind> kinds() {
                                            return Sets.empty();
                                        }
                                    };
                                },
                                (r) -> "@@@" + r.getMessage(),
                                (r) -> {
                                    throw new UnsupportedOperationException();
                                },
                                (r) -> {
                                    throw new UnsupportedOperationException();
                                },
                                CASE_SENSITIVITY,
                                new FakeConverterContext() {
                                    @Override
                                    public <T> Either<T, String> convert(final Object value,
                                                                         final Class<T> target) {
                                        return Cast.to(
                                                Either.left(value)
                                        );
                                    }
                                }
                ),
                name,
                Lists.empty(),
                "@@@Thrown123"
        );
    }

    @Test
    public void testEvaluateFunctionThrowsExceptionTranslated() {
        final ExpressionNumberKind kind = ExpressionNumberKind.DOUBLE;

        final FunctionExpressionName name = FunctionExpressionName.with("test123");

        this.evaluateAndCheck(
                BasicExpressionEvaluationContext.with(
                        ExpressionFunctionContexts.basic(
                                kind,
                                (n) -> {
                                    return new FakeExpressionFunction<>() {
                                        @Override
                                        public Object apply(final List<Object> objects,
                                                            final ExpressionFunctionContext context) {
                                            throw new UnsupportedOperationException("Thrown123");
                                        }

                                        @Override
                                        public FunctionExpressionName name() {
                                            return name;
                                        }

                                        @Override
                                        public List<ExpressionFunctionParameter<?>> parameters() {
                                            return ExpressionFunctionParameter.EMPTY;
                                        }

                                        public Set<ExpressionFunctionKind> kinds() {
                                            return Sets.empty();
                                        }
                                    };
                                },
                                (r) -> "@@@" + r.getMessage(),
                                (r) -> {
                                    throw new UnsupportedOperationException();
                                },
                                (r) -> {
                                    throw new UnsupportedOperationException();
                                },
                                CASE_SENSITIVITY,
                                new FakeConverterContext() {
                                    @Override
                                    public <T> Either<T, String> convert(final Object value,
                                                                         final Class<T> target) {
                                        return Cast.to(
                                                Either.left(value)
                                        );
                                    }
                                }
                        )
                ),
                name,
                Lists.empty(),
                "@@@Thrown123"
        );
    }

Replace Anonymous With Lambda walkingkooka.tree.expression.BasicExpressionEvaluationContextTest.testEvaluateFunctionThrowsExceptionTranslated.evaluateAndCheck.with.basic.new FakeConverterContext with (n) -> {return new FakeExpressionFunction<>(){ in method public testEvaluateFunctionThrowsExceptionTranslated() : void from class walkingkooka.tree.expression.BasicExpressionEvaluationContextTest


                    @Override
                    public Object evaluate(final Expression expression) {
                        Objects.requireNonNull(expression, "expression");

                        return expression.toValue(
                                ExpressionEvaluationContexts.basic(
                                        EXPRESSION_NUMBER_KIND,
                                        (f) -> {
                                            throw new UnsupportedOperationException();
                                        },
                                        new Function<>() {
                                            @Override
                                            public Optional<Expression> apply(final ExpressionReference reference) {
                                                throw new UnsupportedOperationException();
                                            }
                                        },
                                        ExpressionFunctionContexts.fake()
                                        //ExpressionNumberConverterContexts.basic(Converters.fake(), this.converterContext(), EXPRESSION_NUMBER_KIND)
                                )
                        );
                    }

                    @Override
                    public Object evaluate(final Expression expression) {
                        Objects.requireNonNull(expression, "expression");

                        return expression.toValue(
                                ExpressionEvaluationContexts.basic(
                                        EXPRESSION_NUMBER_KIND,
                                        (f) -> {
                                            throw new UnsupportedOperationException();
                                        },
                                        new Function<>() {
                                            @Override
                                            public Optional<Expression> apply(final ExpressionReference reference) {
                                                throw new UnsupportedOperationException();
                                            }
                                        },
                                        ExpressionFunctionContexts.fake(),
                                        ExpressionNumberConverterContexts.basic(Converters.fake(), this.converterContext(), EXPRESSION_NUMBER_KIND)
                                )
                        );
                    }

Replace Anonymous With Lambda walkingkooka.tree.select.NodeSelectorContext2ExpressionNodeSelectorTest.createContext.context.with.new FakeNodeSelectorContext<TestNode,StringName,StringName,Object>.evaluate.toValue.basic.new Function<> with (f) -> {throw new UnsupportedOperationException(); in method public evaluate(expression Expression) : Object from class walkingkooka.tree.select.NodeSelectorContext2ExpressionNodeSelectorTest.createContext.context.with.new FakeNodeSelectorContext<TestNode,StringName,StringName,Object>


    static <N extends Node<N, NAME, ANAME, AVALUE>,
            NAME extends Name,
            ANAME extends Name,
            AVALUE,
            C extends ExpressionEvaluationContext> BasicNodeSelectorContext<N, NAME, ANAME, AVALUE> with(final BooleanSupplier finisher,
                                                                                final Predicate<N> filter,
                                                                                final Function<N, N> mapper,
                                                                                final Function<NodeSelectorContext<N, NAME, ANAME, AVALUE>, C> expressionEvaluationContext,
                                                                                final Class<N> nodeType) {
        Objects.requireNonNull(finisher, "finisher");
        Objects.requireNonNull(filter, "filter");
        Objects.requireNonNull(mapper, "mapper");
        Objects.requireNonNull(expressionEvaluationContext, "expressionEvaluationContext");
        Objects.requireNonNull(nodeType, "nodeType");

        return new BasicNodeSelectorContext<>(finisher,
                filter,
                mapper,
                Cast.to(expressionEvaluationContext));
    }

    static <N extends Node<N, NAME, ANAME, AVALUE>,
            NAME extends Name,
            ANAME extends Name,
            AVALUE,
            C extends ExpressionEvaluationContext> BasicNodeSelectorContext<N, NAME, ANAME, AVALUE> with(final BooleanSupplier finisher,
                                                                                final Predicate<N> filter,
                                                                                final Function<N, N> mapper,
                                                                                final Function<NodeSelectorContext<N, NAME, ANAME, AVALUE>, C> expressionEvaluationContext,
                                                                                final Class<N> nodeType) {
        Objects.requireNonNull(finisher, "finisher");
        Objects.requireNonNull(filter, "filter");
        Objects.requireNonNull(mapper, "mapper");
        Objects.requireNonNull(expressionEvaluationContext, "expressionEvaluationContext");
        Objects.requireNonNull(nodeType, "nodeType");

        return new BasicNodeSelectorContext<N, NAME, ANAME, AVALUE>(finisher,
                filter,
                mapper,
                Cast.to(expressionEvaluationContext));
    }

Replace Generic With Diamond BasicNodeSelectorContext<N,NAME,ANAME,AVALUE> with BasicNodeSelectorContext<> in method package with(finisher BooleanSupplier, filter Predicate<N>, mapper Function<N,N>, expressionEvaluationContext Function<NodeSelectorContext<N,NAME,ANAME,AVALUE>,C>, nodeType Class<N>) : BasicNodeSelectorContext<N,NAME,ANAME,AVALUE> from class walkingkooka.tree.select.BasicNodeSelectorContext


    /**
     * Factory called by {@link NodeSelector#stream}.
     */
    static <N extends Node<N, NAME, ANAME, AVALUE>,
            NAME extends Name,
            ANAME extends Name,
            AVALUE,
            C extends ExpressionNumberConverterContext> NodeSelectorStreamConsumerPushableStreamConsumer<N, NAME, ANAME, AVALUE> with(final N node,
                                                                                final NodeSelector<N, NAME, ANAME, AVALUE> selector,
                                                                                final Function<NodeSelectorContext<N, NAME, ANAME, AVALUE>, ExpressionEvaluationContext> expressionEvaluationContext,
                                                                                final Class<N> nodeType) {
        Objects.requireNonNull(node, "node");

        return new NodeSelectorStreamConsumerPushableStreamConsumer<>(node,
                selector,
                expressionEvaluationContext,
                nodeType);
    }

    /**
     * Factory called by {@link NodeSelector#stream}.
     */
    static <N extends Node<N, NAME, ANAME, AVALUE>,
            NAME extends Name,
            ANAME extends Name,
            AVALUE,
            C extends ExpressionNumberConverterContext> NodeSelectorStreamConsumerPushableStreamConsumer<N, NAME, ANAME, AVALUE> with(final N node,
                                                                                final NodeSelector<N, NAME, ANAME, AVALUE> selector,
                                                                                final Function<NodeSelectorContext<N, NAME, ANAME, AVALUE>, ExpressionEvaluationContext> expressionEvaluationContext,
                                                                                final Class<N> nodeType) {
        Objects.requireNonNull(node, "node");

        return new NodeSelectorStreamConsumerPushableStreamConsumer<N, NAME, ANAME, AVALUE>(node,
                selector,
                expressionEvaluationContext,
                nodeType);
    }

Replace Generic With Diamond NodeSelectorStreamConsumerPushableStreamConsumer<N,NAME,ANAME,AVALUE> with NodeSelectorStreamConsumerPushableStreamConsumer<> in method package with(node N, selector NodeSelector<N,NAME,ANAME,AVALUE>, expressionEvaluationContext Function<NodeSelectorContext<N,NAME,ANAME,AVALUE>,ExpressionEvaluationContext>, nodeType Class<N>) : NodeSelectorStreamConsumerPushableStreamConsumer<N,NAME,ANAME,AVALUE> from class walkingkooka.tree.select.NodeSelectorStreamConsumerPushableStreamConsumer


    private void convertFails3(final ExpressionNumberKind kind,
                               final String value,
                               final Class<?> type) {
        final Converter<ExpressionNumberConverterContext> converter = ExpressionNumber.toConverter(new FakeConverter<>() {
            @Override
            public boolean canConvert(final Object value,
                                      final Class<?> type,
                                      final ExpressionNumberConverterContext context) {
                return false;
            }

            @Override
            public <T> Either<T, String> convert(final Object value,
                                                 final Class<T> type,
                                                 final ExpressionNumberConverterContext context) {
                return this.failConversion(value, type);
            }
        });
        final ExpressionNumberConverterContext context = this.createContext();
        this.checkEquals(false, converter.canConvert(value, type, context));
        this.convertFails(converter,
                value,
                type,
                context);
    }

    private void convertFails3(final ExpressionNumberKind kind,
                               final String value,
                               final Class<?> type) {
        final Converter<ExpressionNumberConverterContext> converter = ExpressionNumber.toConverter(new FakeConverter<ExpressionNumberConverterContext>() {
            @Override
            public boolean canConvert(final Object value,
                                      final Class<?> type,
                                      final ExpressionNumberConverterContext context) {
                return false;
            }

            @Override
            public <T> Either<T, String> convert(final Object value,
                                                 final Class<T> type,
                                                 final ExpressionNumberConverterContext context) {
                return this.failConversion(value, type);
            }
        });
        final ExpressionNumberConverterContext context = this.createContext();
        this.checkEquals(false, converter.canConvert(value, type, context));
        this.convertFails(converter,
                value,
                type,
                context);
    }

Replace Generic With Diamond FakeConverter<ExpressionNumberConverterContext> with FakeConverter<> in method private convertFails3(kind ExpressionNumberKind, value String, type Class<?>) : void from class walkingkooka.tree.expression.ExpressionNumberToExpressionNumberConverterTest


    ExpressionEvaluationContext context() {
        final Function<ExpressionNumberConverterContext, ParserContext> parserContext = (c) -> ParserContexts.basic(c, c);

        final Converter<ExpressionNumberConverterContext> stringDouble = Converters.parser(
                Double.class,
                Parsers.doubleParser(),
                parserContext,
                (v, c) -> v.cast(DoubleParserToken.class).value()
        );
        final Converter<ExpressionNumberConverterContext> stringLocalDate = Converters.parser(
                LocalDate.class,
                Parsers.localDate((c) -> DateTimeFormatter.ISO_LOCAL_DATE),
                parserContext,
                (v, c) -> v.cast(LocalDateParserToken.class).value()
        );
        final Converter<ExpressionNumberConverterContext> stringLocalDateTime = Converters.parser(
                LocalDateTime.class,
                Parsers.localDateTime((c) -> DateTimeFormatter.ISO_LOCAL_DATE_TIME),
                parserContext,
                (v, c) -> v.cast(LocalDateTimeParserToken.class).value()
        );
        final Converter<ExpressionNumberConverterContext> stringLocalTime = Converters.parser(
                LocalTime.class,
                Parsers.localTime((c) -> DateTimeFormatter.ISO_LOCAL_TIME),
                parserContext,
                (v, c) -> v.cast(LocalTimeParserToken.class).value()
        );

        final Converter<ExpressionNumberConverterContext> converters = Converters.collection(
                Lists.of(
                        Converters.simple(),
                        new FakeConverter<>() {
                            @Override
                            public boolean canConvert(final Object value,
                                                      final Class<?> type,
                                                      final ExpressionNumberConverterContext context) {
                                return value instanceof ExpressionNumber && ExpressionNumber.class == type;
                            }

                            @Override
                            public <T> Either<T, String> convert(final Object value,
                                                                 final Class<T> type,
                                                                 final ExpressionNumberConverterContext context) {
                                return this.canConvert(value, type, context) ?
                                        Cast.to(Either.left(this.toExpressionNumber((ExpressionNumber) value))) :
                                        this.failConversion(value, type);
                            }

                            private ExpressionNumber toExpressionNumber(final ExpressionNumber value) {
                                return value.setKind(EXPRESSION_NUMBER_KIND);
                            }
                        },
                        // localDate ->
                        toBoolean(LocalDate.class, LocalDate.ofEpochDay(0)),
                        Converters.localDateLocalDateTime(),
                        ExpressionNumber.toConverter(Converters.localDateNumber(Converters.JAVA_EPOCH_OFFSET)),
                        Converters.localDateString((c) -> DateTimeFormatter.ISO_LOCAL_DATE),
                        // localDateTime ->
                        toBoolean(LocalDateTime.class, LocalDateTime.ofEpochSecond(0, 0, ZoneOffset.UTC)),
                        Converters.localDateTimeLocalDate(),
                        Converters.localDateTimeLocalTime(),
                        ExpressionNumber.toConverter(Converters.localDateTimeNumber(Converters.JAVA_EPOCH_OFFSET)),
                        Converters.localDateTimeString((c) -> DateTimeFormatter.ISO_LOCAL_DATE_TIME),
                        // localTime
                        toBoolean(LocalTime.class, LocalTime.ofNanoOfDay(0)),
                        Converters.localTimeLocalDateTime(),
                        ExpressionNumber.toConverter(Converters.localTimeNumber()),
                        Converters.localTimeString((c) -> DateTimeFormatter.ISO_LOCAL_TIME),
                        // ExpressionNumber ->),
                        ExpressionNumber.fromConverter(Converters.numberNumber()),
                        ExpressionNumber.fromConverter(Converters.truthyNumberBoolean()),
                        ExpressionNumber.fromConverter(Converters.numberLocalDate(Converters.JAVA_EPOCH_OFFSET)),
                        ExpressionNumber.fromConverter(Converters.numberLocalDateTime(Converters.JAVA_EPOCH_OFFSET)),
                        ExpressionNumber.fromConverter(Converters.numberLocalTime()),
                        ExpressionNumber.fromConverter(Converters.numberString((c) -> new DecimalFormat("#.###"))),
                        // Number ->),
                        ExpressionNumber.fromConverter(Converters.numberNumber()),
                        ExpressionNumber.fromConverter(Converters.truthyNumberBoolean()),
                        ExpressionNumber.fromConverter(Converters.numberLocalDate(Converters.JAVA_EPOCH_OFFSET)),
                        ExpressionNumber.fromConverter(Converters.numberLocalDateTime(Converters.JAVA_EPOCH_OFFSET)),
                        ExpressionNumber.fromConverter(Converters.numberLocalTime()),
                        ExpressionNumber.fromConverter(Converters.numberString((c) -> new DecimalFormat("#.###"))),
                        // string ->
                        Converters.<String, Boolean, ExpressionNumberConverterContext>function(v -> v instanceof String, Predicate.isEqual(Boolean.class), Boolean::valueOf),
                        stringLocalDate,
                        stringLocalDateTime,
                        stringLocalTime,
                        ExpressionNumber.toConverter(stringDouble),
                        Converters.objectString(),
                        // boolean ->
                        listToBoolean(),
                        fromBoolean(LocalDate.class, Converters.numberLocalDate(Converters.JAVA_EPOCH_OFFSET)),
                        fromBoolean(LocalDateTime.class, Converters.numberLocalDateTime(Converters.JAVA_EPOCH_OFFSET)),
                        fromBoolean(LocalTime.class, Converters.numberLocalTime()),
                        fromBoolean(ExpressionNumber.class, ExpressionNumber.toConverter(Converters.numberNumber()))
                )
        );

        return new FakeExpressionEvaluationContext() {

            @Override
            public MathContext mathContext() {
                return MathContext.DECIMAL64;
            }

            @Override
            public <T> Either<T, String> convert(final Object value, final Class<T> target) {
                return converters.convert(value, target, ExpressionTestCase.this.converterContext());
            }

            @Override
            public ExpressionNumberKind expressionNumberKind() {
                return EXPRESSION_NUMBER_KIND;
            }
        };
    }

    ExpressionEvaluationContext context() {
        final Function<ExpressionNumberConverterContext, ParserContext> parserContext = (c) -> ParserContexts.basic(c, c);

        final Converter<ExpressionNumberConverterContext> stringDouble = Converters.parser(
                Double.class,
                Parsers.doubleParser(),
                parserContext,
                (v, c) -> v.cast(DoubleParserToken.class).value()
        );
        final Converter<ExpressionNumberConverterContext> stringLocalDate = Converters.parser(
                LocalDate.class,
                Parsers.localDate((c) -> DateTimeFormatter.ISO_LOCAL_DATE),
                parserContext,
                (v, c) -> v.cast(LocalDateParserToken.class).value()
        );
        final Converter<ExpressionNumberConverterContext> stringLocalDateTime = Converters.parser(
                LocalDateTime.class,
                Parsers.localDateTime((c) -> DateTimeFormatter.ISO_LOCAL_DATE_TIME),
                parserContext,
                (v, c) -> v.cast(LocalDateTimeParserToken.class).value()
        );
        final Converter<ExpressionNumberConverterContext> stringLocalTime = Converters.parser(
                LocalTime.class,
                Parsers.localTime((c) -> DateTimeFormatter.ISO_LOCAL_TIME),
                parserContext,
                (v, c) -> v.cast(LocalTimeParserToken.class).value()
        );

        final Converter<ExpressionNumberConverterContext> converters = Converters.collection(
                Lists.of(
                        Converters.simple(),
                        new FakeConverter<ExpressionNumberConverterContext>() {
                            @Override
                            public boolean canConvert(final Object value,
                                                      final Class<?> type,
                                                      final ExpressionNumberConverterContext context) {
                                return value instanceof ExpressionNumber && ExpressionNumber.class == type;
                            }

                            @Override
                            public <T> Either<T, String> convert(final Object value,
                                                                 final Class<T> type,
                                                                 final ExpressionNumberConverterContext context) {
                                return this.canConvert(value, type, context) ?
                                        Cast.to(Either.left(this.toExpressionNumber((ExpressionNumber) value))) :
                                        this.failConversion(value, type);
                            }

                            private ExpressionNumber toExpressionNumber(final ExpressionNumber value) {
                                return value.setKind(EXPRESSION_NUMBER_KIND);
                            }
                        },
                        // localDate ->
                        toBoolean(LocalDate.class, LocalDate.ofEpochDay(0)),
                        Converters.localDateLocalDateTime(),
                        ExpressionNumber.toConverter(Converters.localDateNumber(Converters.JAVA_EPOCH_OFFSET)),
                        Converters.localDateString((c) -> DateTimeFormatter.ISO_LOCAL_DATE),
                        // localDateTime ->
                        toBoolean(LocalDateTime.class, LocalDateTime.ofEpochSecond(0, 0, ZoneOffset.UTC)),
                        Converters.localDateTimeLocalDate(),
                        Converters.localDateTimeLocalTime(),
                        ExpressionNumber.toConverter(Converters.localDateTimeNumber(Converters.JAVA_EPOCH_OFFSET)),
                        Converters.localDateTimeString((c) -> DateTimeFormatter.ISO_LOCAL_DATE_TIME),
                        // localTime
                        toBoolean(LocalTime.class, LocalTime.ofNanoOfDay(0)),
                        Converters.localTimeLocalDateTime(),
                        ExpressionNumber.toConverter(Converters.localTimeNumber()),
                        Converters.localTimeString((c) -> DateTimeFormatter.ISO_LOCAL_TIME),
                        // ExpressionNumber ->),
                        ExpressionNumber.fromConverter(Converters.numberNumber()),
                        ExpressionNumber.fromConverter(Converters.truthyNumberBoolean()),
                        ExpressionNumber.fromConverter(Converters.numberLocalDate(Converters.JAVA_EPOCH_OFFSET)),
                        ExpressionNumber.fromConverter(Converters.numberLocalDateTime(Converters.JAVA_EPOCH_OFFSET)),
                        ExpressionNumber.fromConverter(Converters.numberLocalTime()),
                        ExpressionNumber.fromConverter(Converters.numberString((c) -> new DecimalFormat("#.###"))),
                        // Number ->),
                        ExpressionNumber.fromConverter(Converters.numberNumber()),
                        ExpressionNumber.fromConverter(Converters.truthyNumberBoolean()),
                        ExpressionNumber.fromConverter(Converters.numberLocalDate(Converters.JAVA_EPOCH_OFFSET)),
                        ExpressionNumber.fromConverter(Converters.numberLocalDateTime(Converters.JAVA_EPOCH_OFFSET)),
                        ExpressionNumber.fromConverter(Converters.numberLocalTime()),
                        ExpressionNumber.fromConverter(Converters.numberString((c) -> new DecimalFormat("#.###"))),
                        // string ->
                        Converters.<String, Boolean, ExpressionNumberConverterContext>function(v -> v instanceof String, Predicate.isEqual(Boolean.class), Boolean::valueOf),
                        stringLocalDate,
                        stringLocalDateTime,
                        stringLocalTime,
                        ExpressionNumber.toConverter(stringDouble),
                        Converters.objectString(),
                        // boolean ->
                        listToBoolean(),
                        fromBoolean(LocalDate.class, Converters.numberLocalDate(Converters.JAVA_EPOCH_OFFSET)),
                        fromBoolean(LocalDateTime.class, Converters.numberLocalDateTime(Converters.JAVA_EPOCH_OFFSET)),
                        fromBoolean(LocalTime.class, Converters.numberLocalTime()),
                        fromBoolean(ExpressionNumber.class, ExpressionNumber.toConverter(Converters.numberNumber()))
                )
        );

        return new FakeExpressionEvaluationContext() {

            @Override
            public MathContext mathContext() {
                return MathContext.DECIMAL64;
            }

            @Override
            public <T> Either<T, String> convert(final Object value, final Class<T> target) {
                return converters.convert(value, target, ExpressionTestCase.this.converterContext());
            }

            @Override
            public ExpressionNumberKind expressionNumberKind() {
                return EXPRESSION_NUMBER_KIND;
            }
        };
    }

Replace Generic With Diamond FakeConverter<ExpressionNumberConverterContext> with FakeConverter<> in method package context() : ExpressionEvaluationContext from class walkingkooka.tree.expression.ExpressionTestCase


                    @Override
                    public Object evaluate(final Expression expression) {
                        Objects.requireNonNull(expression, "expression");

                        return expression.toValue(
                                ExpressionEvaluationContexts.basic(EXPRESSION_NUMBER_KIND,
                                        (f) -> {
                                            throw new UnsupportedOperationException();
                                        },
                                        new Function<>() {
                                            @Override
                                            public Optional<Expression> apply(final ExpressionReference reference) {
                                                throw new UnsupportedOperationException();
                                            }
                                        },
                                        ExpressionNumberConverterContexts.basic(Converters.fake(), this.converterContext(), EXPRESSION_NUMBER_KIND)));
                    }

                    @Override
                    public Object evaluate(final Expression expression) {
                        Objects.requireNonNull(expression, "expression");

                        return expression.toValue(
                                ExpressionEvaluationContexts.basic(EXPRESSION_NUMBER_KIND,
                                        (f) -> {
                                            throw new UnsupportedOperationException();
                                        },
                                        new Function<ExpressionReference, Optional<Expression>>() {
                                            @Override
                                            public Optional<Expression> apply(final ExpressionReference reference) {
                                                throw new UnsupportedOperationException();
                                            }
                                        },
                                        ExpressionNumberConverterContexts.basic(Converters.fake(), this.converterContext(), EXPRESSION_NUMBER_KIND)));
                    }

Replace Anonymous With Lambda walkingkooka.tree.select.NodeSelectorContext2ExpressionNodeSelectorTest.createContext.context.with.new FakeNodeSelectorContext<TestNode,StringName,StringName,Object>.evaluate.toValue.basic.new Function<ExpressionReference,Optional<Expression>> with (f) -> {throw new UnsupportedOperationException(); in method public evaluate(expression Expression) : Object from class walkingkooka.tree.select.NodeSelectorContext2ExpressionNodeSelectorTest.createContext.context.with.new FakeNodeSelectorContext<TestNode,StringName,StringName,Object>


    @Override
    public NodeSelectorContext2ExpressionNodeSelector<TestNode, StringName, StringName, Object> createContext() {
        final NodeSelectorContext2ExpressionNodeSelector<TestNode, StringName, StringName, Object> context = NodeSelectorContext2ExpressionNodeSelector.with(
                new FakeNodeSelectorContext<TestNode, StringName, StringName, Object>() {

                    @Override
                    public Object evaluate(final Expression expression) {
                        Objects.requireNonNull(expression, "expression");

                        return expression.toValue(
                                ExpressionEvaluationContexts.basic(EXPRESSION_NUMBER_KIND,
                                        (f) -> {
                                            throw new UnsupportedOperationException();
                                        },
                                        new Function<>() {
                                            @Override
                                            public Optional<Expression> apply(final ExpressionReference reference) {
                                                throw new UnsupportedOperationException();
                                            }
                                        },
                                        ExpressionNumberConverterContexts.basic(Converters.fake(), this.converterContext(), EXPRESSION_NUMBER_KIND)));
                    }

                    private ExpressionNumberConverterContext converterContext() {
                        return ExpressionNumberConverterContexts.basic(this.converter(),
                                ConverterContexts.basic(Converters.fake(),
                                        ConverterContexts.fake(),
                                        DecimalNumberContexts.american(MathContext.DECIMAL32)), EXPRESSION_NUMBER_KIND);
                    }

                    private Converter<ExpressionNumberConverterContext> converter() {
                        return Converters.collection(
                                Lists.of(
                                        ExpressionNumber.toConverter(Converters.truthyNumberBoolean()),
                                        ExpressionNumber.fromConverter(Converters.numberNumber()),
                                        Converters.<String, Integer, ExpressionNumberConverterContext>function(v -> v instanceof String, Predicates.is(Integer.class), Integer::parseInt)
                                )
                        );
                    }
                });
        context.position = INDEX;
        return context;
    }

    @Override
    public NodeSelectorContext2ExpressionNodeSelector<TestNode, StringName, StringName, Object> createContext() {
        final NodeSelectorContext2ExpressionNodeSelector<TestNode, StringName, StringName, Object> context = NodeSelectorContext2ExpressionNodeSelector.with(
                new FakeNodeSelectorContext<TestNode, StringName, StringName, Object>() {

                    @Override
                    public Object evaluate(final Expression expression) {
                        Objects.requireNonNull(expression, "expression");

                        return expression.toValue(
                                ExpressionEvaluationContexts.basic(EXPRESSION_NUMBER_KIND,
                                        (f) -> {
                                            throw new UnsupportedOperationException();
                                        },
                                        new Function<ExpressionReference, Optional<Expression>>() {
                                            @Override
                                            public Optional<Expression> apply(final ExpressionReference reference) {
                                                throw new UnsupportedOperationException();
                                            }
                                        },
                                        ExpressionNumberConverterContexts.basic(Converters.fake(), this.converterContext(), EXPRESSION_NUMBER_KIND)));
                    }

                    private ExpressionNumberConverterContext converterContext() {
                        return ExpressionNumberConverterContexts.basic(this.converter(),
                                ConverterContexts.basic(Converters.fake(),
                                        ConverterContexts.fake(),
                                        DecimalNumberContexts.american(MathContext.DECIMAL32)), EXPRESSION_NUMBER_KIND);
                    }

                    private Converter<ExpressionNumberConverterContext> converter() {
                        return Converters.collection(
                                Lists.of(
                                        ExpressionNumber.toConverter(Converters.truthyNumberBoolean()),
                                        ExpressionNumber.fromConverter(Converters.numberNumber()),
                                        Converters.<String, Integer, ExpressionNumberConverterContext>function(v -> v instanceof String, Predicates.is(Integer.class), Integer::parseInt)
                                )
                        );
                    }
                });
        context.position = INDEX;
        return context;
    }

Replace Generic With Diamond Function<ExpressionReference,Optional<Expression>> with Function<> in method public createContext() : NodeSelectorContext2ExpressionNodeSelector<TestNode,StringName,StringName,Object> from class walkingkooka.tree.select.NodeSelectorContext2ExpressionNodeSelectorTest


    private Function<NodeSelectorContext<TestNode, StringName, StringName, Object>, ExpressionEvaluationContext> expressionEvaluationContext() {
        return new Function<>() {
            @Override
            public ExpressionEvaluationContext apply(final NodeSelectorContext<TestNode, StringName, StringName, Object> context) {
                return ExpressionEvaluationContexts.basic(ExpressionNumberKind.DEFAULT,
                        this.functions(),
                        this.references(),
                        this.converterContext());
            }

            private Function<FunctionExpressionName, ExpressionFunction<?, ExpressionFunctionContext>> functions() {
                return (n) -> {
                    throw new UnsupportedOperationException();
                };
            }

            private Function<ExpressionReference, Optional<Expression>> references() {
                return (r) -> Optional.empty();
            }

            private ExpressionNumberConverterContext converterContext() {
                return ExpressionNumberConverterContexts.basic(ExpressionNumber.toConverter(Converters.fake()),
                        ConverterContexts.basic(Converters.fake(),
                                DateTimeContexts.fake(),
                                DecimalNumberContexts.fake()), KIND);
            }

            public String toString() {
                return "factory123";
            }
        };
    }

    private Function<NodeSelectorContext<TestNode, StringName, StringName, Object>, ExpressionEvaluationContext> expressionEvaluationContext() {
        return new Function<NodeSelectorContext<TestNode, StringName, StringName, Object>, ExpressionEvaluationContext>() {
            @Override
            public ExpressionEvaluationContext apply(final NodeSelectorContext<TestNode, StringName, StringName, Object> context) {
                return ExpressionEvaluationContexts.basic(ExpressionNumberKind.DEFAULT,
                        this.functions(),
                        this.references(),
                        this.converterContext());
            }

            private BiFunction<FunctionExpressionName, List<Object>, Object> functions() {
                return (n, p) -> {
                    throw new UnsupportedOperationException();
                };
            }

            private Function<ExpressionReference, Optional<Expression>> references() {
                return (r) -> Optional.empty();
            }

            private ExpressionNumberConverterContext converterContext() {
                return ExpressionNumberConverterContexts.basic(ExpressionNumber.toConverter(Converters.fake()),
                        ConverterContexts.basic(Converters.fake(),
                                DateTimeContexts.fake(),
                                DecimalNumberContexts.fake()), KIND);
            }

            public String toString() {
                return "factory123";
            }
        };
    }

Replace Generic With Diamond Function<NodeSelectorContext<TestNode,StringName,StringName,Object>,ExpressionEvaluationContext> with Function<> in method private expressionEvaluationContext() : Function<NodeSelectorContext<TestNode,StringName,StringName,Object>,ExpressionEvaluationContext> from class walkingkooka.tree.select.BasicNodeSelectorContextTest


                    @Override
                    public Object evaluate(final Expression expression) {
                        Objects.requireNonNull(expression, "expression");

                        return expression.toValue(
                                ExpressionEvaluationContexts.basic(EXPRESSION_NUMBER_KIND,
                                        (f) -> {
                                            throw new UnsupportedOperationException();
                                        },
                                        new Function<ExpressionReference, Optional<Expression>>() {
                                            @Override
                                            public Optional<Expression> apply(final ExpressionReference reference) {
                                                throw new UnsupportedOperationException();
                                            }
                                        },
                                        ExpressionNumberConverterContexts.basic(Converters.fake(), this.converterContext(), EXPRESSION_NUMBER_KIND)));
                    }

                    @Override
                    public Object evaluate(final Expression expression) {
                        Objects.requireNonNull(expression, "expression");

                        return expression.toValue(
                                ExpressionEvaluationContexts.basic(EXPRESSION_NUMBER_KIND,
                                        (f, p) -> {
                                            throw new UnsupportedOperationException();
                                        },
                                        new Function<ExpressionReference, Optional<Expression>>() {
                                            @Override
                                            public Optional<Expression> apply(final ExpressionReference reference) {
                                                throw new UnsupportedOperationException();
                                            }
                                        },
                                        ExpressionNumberConverterContexts.basic(Converters.fake(), this.converterContext(), EXPRESSION_NUMBER_KIND)));
                    }


                    @Override
                    public Object evaluate(final Expression expression) {
                        Objects.requireNonNull(expression, "expression");

                        return expression.toValue(
                                ExpressionEvaluationContexts.basic(EXPRESSION_NUMBER_KIND,
                                        (f, p) -> {
                                            throw new UnsupportedOperationException();
                                        },
                                        new Function<ExpressionReference, Optional<Expression>>() {
                                            @Override
                                            public Optional<Expression> apply(final ExpressionReference reference) {
                                                throw new UnsupportedOperationException();
                                            }
                                        },
                                        ExpressionNumberConverterContexts.basic(Converters.fake(), this.converterContext(), EXPRESSION_NUMBER_KIND)));
                    }

                    @Override
                    public Object evaluate(final Expression expression) {
                        Objects.requireNonNull(expression, "expression");

                        return expression.toValue(
                                ExpressionEvaluationContexts.basic(EXPRESSION_NUMBER_KIND,
                                        (e, parameters) -> {
                                            throw new UnsupportedOperationException();
                                        },
                                        new Function<ExpressionReference, Optional<Expression>>() {
                                            @Override
                                            public Optional<Expression> apply(final ExpressionReference reference) {
                                                throw new UnsupportedOperationException();
                                            }
                                        },
                                        this.converter(),
                                        ExpressionNumberConverterContexts.basic(Converters.fake(), this.converterContext(), EXPRESSION_NUMBER_KIND)));
                    }

Replace Anonymous With Lambda walkingkooka.tree.select.NodeSelectorContext2ExpressionNodeSelectorTest.createContext.context.with.new FakeNodeSelectorContext<TestNode,StringName,StringName,Object>.evaluate.toValue.basic.new Function<ExpressionReference,Optional<Expression>> with (f, p) -> {throw new UnsupportedOperationException(); in method public evaluate(expression Expression) : Object from class walkingkooka.tree.select.NodeSelectorContext2ExpressionNodeSelectorTest.createContext.context.with.new FakeNodeSelectorContext<TestNode,StringName,StringName,Object>


                    @Override
                    public Object evaluate(final Expression expression) {
                        Objects.requireNonNull(expression, "expression");

                        return expression.toValue(
                                ExpressionEvaluationContexts.basic(EXPRESSION_NUMBER_KIND,
                                        (e, parameters) -> {
                                            throw new UnsupportedOperationException();
                                        },
                                        new Function<ExpressionReference, Optional<Expression>>() {
                                            @Override
                                            public Optional<Expression> apply(final ExpressionReference reference) {
                                                throw new UnsupportedOperationException();
                                            }
                                        },
                                        this.converter(),
                                        ExpressionNumberConverterContexts.basic(Converters.fake(), this.converterContext(), EXPRESSION_NUMBER_KIND)));
                    }

                    @Override
                    public Object evaluate(final Expression expression) {
                        Objects.requireNonNull(expression, "expression");

                        return expression.toValue(
                                ExpressionEvaluationContexts.basic(EXPRESSION_NUMBER_KIND,
                                        (e, parameters) -> {
                                            throw new UnsupportedOperationException();
                                        },
                                        new Function<ExpressionReference, Optional<Expression>>() {
                                            @Override
                                            public Optional<Expression> apply(final ExpressionReference reference) {
                                                throw new UnsupportedOperationException();
                                            }
                                        },
                                        this.converter(),
                                        ExpressionNumberConverterContexts.basic(this.converterContext(), EXPRESSION_NUMBER_KIND)));
                    }

Replace Anonymous With Lambda walkingkooka.tree.select.NodeSelectorContext2ExpressionNodeSelectorTest.createContext.context.with.new FakeNodeSelectorContext<TestNode,StringName,StringName,Object>.evaluate.toValue.basic.new Function<ExpressionReference,Optional<Expression>> with (e, parameters) -> {throw new UnsupportedOperationException(); in method public evaluate(expression Expression) : Object from class walkingkooka.tree.select.NodeSelectorContext2ExpressionNodeSelectorTest.createContext.context.with.new FakeNodeSelectorContext<TestNode,StringName,StringName,Object>


                    @Override
                    public Object evaluate(final Expression expression) {
                        Objects.requireNonNull(expression, "expression");

                        return expression.toValue(
                                ExpressionEvaluationContexts.basic(EXPRESSION_NUMBER_KIND,
                                        (e, parameters) -> {
                                            throw new UnsupportedOperationException();
                                        },
                                        new Function<ExpressionReference, Optional<Expression>>() {
                                            @Override
                                            public Optional<Expression> apply(final ExpressionReference reference) {
                                                throw new UnsupportedOperationException();
                                            }
                                        },
                                        this.converter(),
                                        ExpressionNumberConverterContexts.basic(this.converterContext(), EXPRESSION_NUMBER_KIND)));
                    }

                    @Override
                    public Object evaluate(final Expression expression) {
                        Objects.requireNonNull(expression, "expression");

                        return expression.toExpressionNumber(
                                ExpressionEvaluationContexts.basic(EXPRESSION_NUMBER_KIND,
                                        (e, parameters) -> {
                                            throw new UnsupportedOperationException();
                                        },
                                        new Function<ExpressionReference, Optional<Expression>>() {
                                            @Override
                                            public Optional<Expression> apply(ExpressionReference expressionReference) {
                                                throw new UnsupportedOperationException();
                                            }
                                        },
                                        this.converter(),
                                        ExpressionNumberConverterContexts.basic(this.converterContext(), EXPRESSION_NUMBER_KIND)));
                    }

Replace Anonymous With Lambda walkingkooka.tree.select.ExpressionNodeSelectorNodeSelectorContext2Test.createContext.context.with.new FakeNodeSelectorContext<TestNode,StringName,StringName,Object>.evaluate.toExpressionNumber.basic.new Function<ExpressionReference,Optional<Expression>> with (e, parameters) -> {throw new UnsupportedOperationException(); in method public evaluate(expression Expression) : Object from class walkingkooka.tree.select.ExpressionNodeSelectorNodeSelectorContext2Test.createContext.context.with.new FakeNodeSelectorContext<TestNode,StringName,StringName,Object>


    @Override
    public ExpressionNumberFromExpressionNumberNumberConverter<ExpressionNumberConverterContext> createConverter() {
        return ExpressionNumberFromExpressionNumberNumberConverter.with(Converters.numberString(new Function<>() {
            @Override
            public DecimalFormat apply(final DecimalNumberContext decimalNumberContext) {
                return (DecimalFormat) DecimalFormat.getInstance();
            }

            // want to override toString
            @Override
            public String toString() {
                return "DecimalFormat.getInstance";
            }
        }));
    }

    @Override
    public ExpressionNumberFromExpressionNumberNumberConverter<ConverterContext> createConverter() {
        return ExpressionNumberFromExpressionNumberNumberConverter.with(Converters.numberString(new Function<DecimalNumberContext, DecimalFormat>() {
            @Override
            public DecimalFormat apply(DecimalNumberContext decimalNumberContext) {
                return (DecimalFormat) DecimalFormat.getInstance();
            }

            // want to override toString
            @Override
            public String toString() {
                return "DecimalFormat.getInstance";
            }
        }));
    }

Replace Generic With Diamond Function<DecimalNumberContext,DecimalFormat> with Function<> in method public createConverter() : ExpressionNumberFromExpressionNumberNumberConverter<ExpressionNumberConverterContext> from class walkingkooka.tree.expression.ExpressionNumberFromExpressionNumberNumberConverterTest


    public List<AlunoDadosDto> buscarNome(String nome) {
        List<AlunoDadosDto> lista_alunos = new ArrayList<AlunoDadosDto>();
        String sql = "SELECT * FROM ALUNO_DADOS WHERE NOME = ?";

        try (Connection conexao = Conexao.getInstance().getConnection();
                PreparedStatement statement = conexao.prepareStatement(sql);) {
            statement.setString(1, nome.toUpperCase(Locale.ENGLISH));

            try (ResultSet resultset = statement.executeQuery()) {
                while (resultset.next()) {
                    AlunoDadosDto aluno = new AlunoDadosDto();
                    aluno.setCpf(resultset.getString("CPF"));
                    aluno.setNome(resultset.getString("NOME"));
                    Date sql_data = resultset.getDate("DATA_NASCIMENTO");
                    if (sql_data != null) {
                        LocalDate data = sql_data.toLocalDate();
                        aluno.setDataNascimento(data);
                    }

                    lista_alunos.add(aluno);
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return lista_alunos;
    }

    public List<AlunoDadosDto> buscarNome(String nome) {
        List<AlunoDadosDto> lista_alunos = new ArrayList<AlunoDadosDto>();
        try {
            Connection conexao = Conexao.getInstance().getConnection();
            String sql = "SELECT * FROM ALUNOS_DADOS WHERE NOME = ?";
            PreparedStatement statement = conexao.prepareStatement(sql);
            statement.setString(1, nome.toUpperCase(Locale.ENGLISH));

            ResultSet resultset = statement.executeQuery();

            while (resultset.next()) {
                AlunoDadosDto aluno = new AlunoDadosDto();
                aluno.setCpf(resultset.getString("CPF"));
                aluno.setNome(resultset.getString("NOME"));
                aluno.setDataNascimento(resultset.getString("DATA_NASCIMENTO"));

                lista_alunos.add(aluno);
            }
            conexao.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return lista_alunos;
    }

Try With Resources try(ResultSet resultset=statement.executeQuery()) in method public buscarNome(nome String) : List<AlunoDadosDto> from class com.example.dao.AlunoDadosDao


    public boolean adicionarExercicio(ExerciciosDto exercicio) {

        String sql = "INSERT INTO exercicios (nome, musculosativos) VALUES (?, ?)";

        try (Connection conexao = Conexao.getInstance().getConnection();
                PreparedStatement statement = conexao.prepareStatement(sql);) {

            statement.setString(1, exercicio.getNome());
            statement.setString(2, exercicio.getMusculosAtivos());

            int linhasInseridas = statement.executeUpdate();
            return linhasInseridas > 0;
        } catch (ClassNotFoundException e) {
            System.out.println("Erro ao inserir exercicio: " + e.getMessage());
        } catch (SQLException e) {
            System.out.println("Erro ao inserir exercicio: " + e.getMessage());
        }
        return false;
    }

    public static void adicionarExercicio(Exercicios exercicio) {

        // Conexao connection;

        String sql = "INSERT INTO exercicios (numero, nome, musculosativos) VALUES (?, ?, ?)";

        Connection conexao = null;
        try {
            conexao = Conexao.getInstance().getConnection();
            PreparedStatement statement = conexao.prepareStatement(sql);
            statement.setInt(1, exercicio.getNumero());
            statement.setString(2, exercicio.getNome());
            statement.setString(3, exercicio.getMusculosAtivos());

            int linhasInseridas = statement.executeUpdate();
            if (linhasInseridas > 0) {
                System.out.println("Exercício inserido com sucesso!");
            }
        } catch (ClassNotFoundException e) {
            System.out.println("Erro ao inserir exercicio: " + e.getMessage());
        } catch (SQLException e) {
            System.out.println("Erro ao inserir exercicio: " + e.getMessage());
        } finally {
            Conexao.desconectarBancoDados(conexao);
        }
    }

Try With Resources try(Connection conexao=Conexao.getInstance().getConnection(); PreparedStatement statement=conexao.prepareStatement(sql)) in method public adicionarExercicio(exercicio ExerciciosDto) : boolean from class com.example.dao.ExerciciosUtils


    public boolean adicionarPlano(PlanoDto plano) {

        String sql = "INSERT INTO planos (nome, mensalidade) VALUES (?, ?)";

        try (Connection conexao = Conexao.getInstance().getConnection();
                PreparedStatement statement = conexao.prepareStatement(sql);) {
            statement.setString(1, plano.getNome());
            statement.setDouble(2, plano.getMensalidade());
            int linhasInseridas = statement.executeUpdate();
            return linhasInseridas > 0;

        } catch (ClassNotFoundException e) {
            System.out.println("Erro ao inserir plano: " + e.getMessage());
            e.printStackTrace();
        } catch (SQLException e) {
            System.out.println("Erro ao inserir plano: " + e.getMessage());
        }
        return false;
    }

    public static void adicionarPlano(Planos plano) {

        String sql = "INSERT INTO planos (codigo, nome, mensalidade) VALUES (?, ?, ?)";

        Connection connection = null;
        try {
            connection = Conexao.getInstance().getConnection();
            PreparedStatement statement = connection.prepareStatement(sql);

            statement.setInt(1, plano.getCodigo());
            statement.setString(2, plano.getNome());
            statement.setFloat(3, plano.getMensalidade());

            int linhasInseridas = statement.executeUpdate();
            if (linhasInseridas > 0) {
                System.out.println("Plano inserido com sucesso!");
            }
        } catch (ClassNotFoundException e) {
            System.out.println("Erro ao inserir plano: " + e.getMessage());
            e.printStackTrace();
        } catch (SQLException e) {
            System.out.println("Erro ao inserir plano: " + e.getMessage());
        } finally {
            Conexao.desconectarBancoDados(connection);
        }

    }

Try With Resources try(Connection conexao=Conexao.getInstance().getConnection(); PreparedStatement statement=conexao.prepareStatement(sql)) in method public adicionarPlano(plano PlanoDto) : boolean from class com.example.dao.PlanosUtils


    public static <T extends Collection<?>> ListQuery<T> from(T source) {
        return new ListQuery<>(source);
    }

    public static <T extends Collection<?>> ListQuery<T> from(T source) {
        return new ListQuery<T>(source);
    }

Replace Generic With Diamond ListQuery<T> with ListQuery<> in method public from(source T) : ListQuery<T> from class org.casper.query.ListQuery


    /**
     * Sets the source object
     *
     * @param t   the source object
     * @param <T>
     * @return new instance of ObjectMatcher with source object set
     * @since 1.2
     */
    public static <T> ObjectMatcher<T> match(T t) {
        return new ObjectMatcher<>(t);
    }

    /**
     * Sets the source object
     *
     * @param t   the source object
     * @param <T>
     * @return new instance of ObjectMatcher with source object set
     * @since 1.2
     */
    public static <T> ObjectMatcher<T> match(T t) {
        return new ObjectMatcher<T>(t);
    }

Replace Generic With Diamond ObjectMatcher<T> with ObjectMatcher<> in method public match(t T) : ObjectMatcher<T> from class org.casper.query.ObjectMatcher


    public Flight(int fleetId, String filename, Connection connection) throws IOException, FatalFlightFileException, FlightAlreadyExistsException, SQLException {
        this.fleetId = fleetId;
        this.filename = filename;
        String[] parts = filename.split("/");
        this.suggestedTailNumber = parts[0];
        this.tailConfirmed = false;

        try {
            File file = new File(this.filename);
            FileInputStream fileInputStream = new FileInputStream(file);

            InputStream inputStream = getReusableInputStream(fileInputStream);

            int length = inputStream.available();
            inputStream.mark(length);
            setMD5Hash(inputStream);

            //check to see if a flight with this MD5 hash already exists in the database
            if (connection != null) checkIfExists(connection);

            inputStream.reset();
            process(connection, inputStream);

       //} catch (FileNotFoundException e) {
       //   System.err.println("ERROR: could not find flight file '" + filename + "'");
       //   exceptions.add(e);
        } catch (FatalFlightFileException | IOException | SQLException e) {
            status = "WARNING";
            throw e;
        }

        checkExceptions();
    }

    public Flight(int fleetId, String filename, Connection connection) throws IOException, FatalFlightFileException, FlightAlreadyExistsException, SQLException {
        this.fleetId = fleetId;
        this.filename = filename;
        String[] parts = filename.split("/");
        this.suggestedTailNumber = parts[0];
        this.tailConfirmed = false;

        try {
            File file = new File(this.filename);
            FileInputStream fileInputStream = new FileInputStream(file);

            InputStream inputStream = getReusableInputStream(fileInputStream);

            int length = inputStream.available();
            inputStream.mark(length);
            setMD5Hash(inputStream);

            //check to see if a flight with this MD5 hash already exists in the database
            if (connection != null) checkIfExists(connection);

            inputStream.reset();
            process(connection, inputStream);

       //} catch (FileNotFoundException e) {
       //   System.err.println("ERROR: could not find flight file '" + filename + "'");
       //   exceptions.add(e);
        } catch (FatalFlightFileException | IOException | SQLException e) {
            status = "WARNING";
            throw e;
        } catch (SQLException e) {
            System.err.println(e);
            e.printStackTrace();
            System.exit(1);
        }

        checkExceptions();
    }

Merge Catch [catch(FatalFlightFileException|IOException|SQLException e), catch(SQLException e)] to catch(FatalFlightFileException|IOException|SQLException e) in method public Flight(fleetId int, filename String, connection Connection) from class org.ngafid.flights.Flight


    public Flight(String zipEntryName, InputStream inputStream, Connection connection) throws IOException, FatalFlightFileException, FlightAlreadyExistsException {
        this.filename = zipEntryName;
        this.tailConfirmed = false;

        /*
        if (!filename.contains("/")) {
            throw new FatalFlightFileException("The flight file was not in a directory in the zip file. Flight files should be in a directory with the name of their tail number (or other aircraft identifier).");
        }
        */

        String[] parts = zipEntryName.split("/");
        if (parts.length <= 1) {
            suggestedTailNumber = null;
        } else {
            this.suggestedTailNumber = parts[0];
            if (suggestedTailNumber.equals("")) suggestedTailNumber = null;
        }

        try {
            inputStream = getReusableInputStream(inputStream);

            int length = inputStream.available();
            inputStream.mark(length);
            setMD5Hash(inputStream);

            //check to see if a flight with this MD5 hash already exists in the database
            if (connection != null) checkIfExists(connection);

            inputStream.reset();
            process(inputStream);

        } catch (FatalFlightFileException | IOException e) {
            status = "WARNING";
            throw e;
        }

        checkExceptions();
    }

    public Flight(String zipEntryName, InputStream inputStream, Connection connection) throws IOException, FatalFlightFileException, FlightAlreadyExistsException {
        this.filename = zipEntryName;
        this.tailConfirmed = false;

        /*
        if (!filename.contains("/")) {
            throw new FatalFlightFileException("The flight file was not in a directory in the zip file. Flight files should be in a directory with the name of their tail number (or other aircraft identifier).");
        }
        */

        String[] parts = zipEntryName.split("/");
        if (parts.length <= 1) {
            suggestedTailNumber = null;
        } else {
            this.suggestedTailNumber = parts[0];
            if (suggestedTailNumber.equals("")) suggestedTailNumber = null;
        }

        try {
            inputStream = getReusableInputStream(inputStream);

            int length = inputStream.available();
            inputStream.mark(length);
            setMD5Hash(inputStream);

            //check to see if a flight with this MD5 hash already exists in the database
            if (connection != null) checkIfExists(connection);

            inputStream.reset();
            process(inputStream);

        } catch (FatalFlightFileException e) {
            status = "WARNING";
            throw e;
        } catch (IOException e) {
            status = "WARNING";
            throw e;
        }

        checkExceptions();
    }

Merge Catch [catch(FatalFlightFileException e), catch(IOException e)] to catch(FatalFlightFileException|IOException e) in method public Flight(zipEntryName String, inputStream InputStream, connection Connection) from class org.ngafid.flights.Flight


    public Flight(String filename, Connection connection) throws IOException, FatalFlightFileException, FlightAlreadyExistsException {
        this.filename = filename;
        String[] parts = filename.split("/");
        this.suggestedTailNumber = parts[0];
        this.tailConfirmed = false;

        try {
            File file = new File(this.filename);
            FileInputStream fileInputStream = new FileInputStream(file);

            InputStream inputStream = getReusableInputStream(fileInputStream);

            int length = inputStream.available();
            inputStream.mark(length);
            setMD5Hash(inputStream);

            //check to see if a flight with this MD5 hash already exists in the database
            if (connection != null) checkIfExists(connection);

            inputStream.reset();
            process(inputStream);

       //} catch (FileNotFoundException e) {
       //   System.err.println("ERROR: could not find flight file '" + filename + "'");
       //   exceptions.add(e);
        } catch (FatalFlightFileException | IOException e) {
            status = "WARNING";
            throw e;
        }

        checkExceptions();
    }

    public Flight(String filename, Connection connection) throws IOException, FatalFlightFileException, FlightAlreadyExistsException {
        this.filename = filename;
        String[] parts = filename.split("/");
        this.suggestedTailNumber = parts[0];
        this.tailConfirmed = false;

        try {
            File file = new File(this.filename);
            FileInputStream fileInputStream = new FileInputStream(file);

            InputStream inputStream = getReusableInputStream(fileInputStream);

            int length = inputStream.available();
            inputStream.mark(length);
            setMD5Hash(inputStream);

            //check to see if a flight with this MD5 hash already exists in the database
            if (connection != null) checkIfExists(connection);

            inputStream.reset();
            process(inputStream);

       //} catch (FileNotFoundException e) {
       //   System.err.println("ERROR: could not find flight file '" + filename + "'");
       //   exceptions.add(e);
        } catch (FatalFlightFileException e) {
            status = "WARNING";
            throw e;
        } catch (IOException e) {
            status = "WARNING";
            throw e;
        }

        checkExceptions();
    }

Merge Catch [catch(FatalFlightFileException e), catch(IOException e)] to catch(FatalFlightFileException|IOException e) in method public Flight(filename String, connection Connection) from class org.ngafid.flights.Flight


    public Airport(String iataCode, String siteNumber, String type, double latitude, double longitude) {
        this.iataCode = iataCode;
        this.siteNumber = siteNumber;
        this.type = type;
        this.latitude = latitude;
        this.longitude = longitude;

        this.geoHash = GeoHash.getGeoHash(latitude, longitude);

        runways = new HashMap<>();
    }

    public Airport(String iataCode, String siteNumber, String type, double latitude, double longitude) {
        this.iataCode = iataCode;
        this.siteNumber = siteNumber;
        this.type = type;
        this.latitude = latitude;
        this.longitude = longitude;

        this.geoHash = GeoHash.getGeoHash(latitude, longitude);

        runways = new ArrayList<Runway>();
    }

Replace Generic With Diamond ArrayList<Runway> with HashMap<> in method public Airport(iataCode String, siteNumber String, type String, latitude double, longitude double) from class org.ngafid.airports.Airport


	public BlockImage(Translator translator, String src, String alt) {
		super(
			translator,
			new HashMap<>()
				{{
					put("src", src);
					put("alt", alt);
				}}
		     );
	}

	public BlockImage(Translator translator, String src, String alt) {
		super(
			translator,
			new HashMap<String,String>()
				{{
					put("src", src);
					put("alt", alt);
				}}
		     );
	}

Replace Generic With Diamond HashMap<String,String> with HashMap<> in method public BlockImage(translator Translator, src String, alt String) from class us.parr.bookish.model.BlockImage


    private static Set<Method> overridableMethods(final Class<?> type) {
        final Set<Class<?>> alreadyVisited = new HashSet<>();
        final Set<Method> methods = new TreeSet<>((method1, method2) -> {
            int value;

            do {
                value = method1.getName().compareTo(method2.getName());
                if (0 != value) {
                    break;
                }

                final Class<?>[] parameterTypes1 = method1.getParameterTypes();
                final Class<?>[] parameterTypes2 = method2.getParameterTypes();
                value = parameterTypes1.length - parameterTypes2.length;
                if (0 != value) {
                    break;
                }
                // HACK Need a better way to determine if a method overrides another generic method.
                // for (int i = 0; i < parameterTypes1.length; i++) {
                // value = parameterTypes1[i].getName().compareTo(parameterTypes2[i].getName());
                // if (0 != value) {
                // break;
                // }
                // }
            } while (false);

            return value;
        });
        processImplementedInterfaces(type, alreadyVisited, methods);
        processClassAndImplementedInterfaces(type.getSuperclass(), alreadyVisited, methods);
        return methods;
    }

    private static Set<Method> overridableMethods(final Class<?> type) {
        final Set<Class<?>> alreadyVisited = new HashSet<>();
        final Set<Method> methods = new TreeSet<>(new Comparator<>() {

            @Override
            public int compare(final Method method1, final Method method2) {
                int value;

                do {
                    value = method1.getName().compareTo(method2.getName());
                    if (0 != value) {
                        break;
                    }

                    final Class<?>[] parameterTypes1 = method1.getParameterTypes();
                    final Class<?>[] parameterTypes2 = method2.getParameterTypes();
                    value = parameterTypes1.length - parameterTypes2.length;
                    if (0 != value) {
                        break;
                    }
                    // HACK Need a better way to determine if a method overrides another generic method.
                    // for (int i = 0; i < parameterTypes1.length; i++) {
                    // value = parameterTypes1[i].getName().compareTo(parameterTypes2[i].getName());
                    // if (0 != value) {
                    // break;
                    // }
                    // }
                } while (false);

                return value;
            }
        });
        processImplementedInterfaces(type, alreadyVisited, methods);
        processClassAndImplementedInterfaces(type.getSuperclass(), alreadyVisited, methods);
        return methods;
    }

Replace Anonymous With Lambda walkingkooka.test.ClassMethodTesting.overridableMethods.methods.new TreeSet<>.new Comparator<> with (method1, method2) -> {int value; in method private overridableMethods(type Class<?>) : Set<Method> from class walkingkooka.test.ClassMethodTesting


    @Test
    public void testLabelUsesToStringBuilderChangesBuilderState() {
        final String labelSeparator2 = "<LABEL1-SEPARATOR-2>";
        final String separator2 = "<SEPARATOR-2>";
        final String valueSeparator2 = "<VALUE-SEPARATOR-2>";
        final String value3a = "value3a";
        final String value3b = "value3b";

        this.buildAndCheck(this.builder()//
                        .disable(ToStringBuilderOption.QUOTE)//
                        .enable(ToStringBuilderOption.INLINE_ELEMENTS)
                        .label(LABEL1)
                        .value(builder -> {
                            builder.separator("/")
                                    .labelSeparator(labelSeparator2)
                                    .separator(separator2)
                                    .valueSeparator(valueSeparator2)
                                    .enable(ToStringBuilderOption.QUOTE);
                            builder.value(VALUE1);
                            builder.label(LABEL2)
                                    .value(Lists.of(20, 21));
                        })//
                        .label(LABEL3)
                        .value(Lists.of(value3a, value3b)), //
                LABEL1 + LABEL_SEPARATOR +
                        '"' + VALUE1 + '"' + separator2 +
                        LABEL2 + labelSeparator2 + 20 + valueSeparator2 + 21 + SEPARATOR +
                        LABEL3 + LABEL_SEPARATOR + value3a + VALUE_SEPARATOR + value3b);
    }

    @Test
    public void testLabelUsesToStringBuilderChangesBuilderState() {
        final String labelSeparator2 = "<LABEL1-SEPARATOR-2>";
        final String separator2 = "<SEPARATOR-2>";
        final String valueSeparator2 = "<VALUE-SEPARATOR-2>";
        final String value3a = "value3a";
        final String value3b = "value3b";

        this.buildAndCheck(this.builder()//
                        .disable(ToStringBuilderOption.QUOTE)//
                        .enable(ToStringBuilderOption.INLINE_ELEMENTS)
                        .label(LABEL1)
                        .value(new UsesToStringBuilder() {

                            @Override
                            public void buildToString(final ToStringBuilder builder) {
                                builder.separator("/")
                                        .labelSeparator(labelSeparator2)
                                        .separator(separator2)
                                        .valueSeparator(valueSeparator2)
                                        .enable(ToStringBuilderOption.QUOTE);
                                builder.value(VALUE1);
                                builder.label(LABEL2)
                                        .value(Lists.of(20, 21));
                            }
                        })//
                        .label(LABEL3)
                        .value(Lists.of(value3a, value3b)), //
                LABEL1 + LABEL_SEPARATOR +
                        '"' + VALUE1 + '"' + separator2 +
                        LABEL2 + labelSeparator2 + 20 + valueSeparator2 + 21 + SEPARATOR +
                        LABEL3 + LABEL_SEPARATOR + value3a + VALUE_SEPARATOR + value3b);
    }

Replace Anonymous With Lambda walkingkooka.ToStringBuilderAppenderUsesToStringBuilderScalarTest.testLabelUsesToStringBuilderChangesBuilderState.buildAndCheck.value.label.value.new UsesToStringBuilder with builder -> {builder.separator("/").labelSeparator(labelSeparator2).separator(separator2).valueSeparator(valueSeparator2).enable(ToStringBuilderOption.QUOTE); in method public testLabelUsesToStringBuilderChangesBuilderState() : void from class walkingkooka.ToStringBuilderAppenderUsesToStringBuilderScalarTest


    @Test
    public void testLabelUsesToStringBuilderChangesBuilderState2() {
        final String labelSeparator2 = "<LABEL1-SEPARATOR-2>";
        final String separator2 = "<SEPARATOR-2>";
        final String valueSeparator2 = "<VALUE-SEPARATOR-2>";

        final String value2 = "value2";
        final String value4a = "value4a";
        final String value4b = "value4b";

        this.buildAndCheck(this.builder()//
                        .disable(ToStringBuilderOption.QUOTE)//
                .enable(ToStringBuilderOption.INLINE_ELEMENTS)//
                        .label(LABEL1)
                        .value(VALUE1) //
                        .label(LABEL2)
                        .value(builder -> {
                            builder.separator("/")
                                    .labelSeparator(labelSeparator2)
                                    .separator(separator2)
                                    .valueSeparator(valueSeparator2)
                                    .enable(ToStringBuilderOption.QUOTE);
                            builder.value(value2);
                            builder.label(LABEL3).value(Lists.of(30, 31));
                        })//
                        .label(LABEL4)
                        .value(Lists.of(value4a, value4b)), //
                LABEL1 + LABEL_SEPARATOR + VALUE1 + SEPARATOR +
                        LABEL2 + LABEL_SEPARATOR + '"' + value2 + '"' + separator2 +
                        LABEL3 + labelSeparator2 + 30 + valueSeparator2 + 31 + SEPARATOR +
                        LABEL4 + LABEL_SEPARATOR + value4a + VALUE_SEPARATOR + value4b);
    }

    @Test
    public void testLabelUsesToStringBuilderChangesBuilderState2() {
        final String labelSeparator2 = "<LABEL1-SEPARATOR-2>";
        final String separator2 = "<SEPARATOR-2>";
        final String valueSeparator2 = "<VALUE-SEPARATOR-2>";

        final String value2 = "value2";
        final String value4a = "value4a";
        final String value4b = "value4b";

        this.buildAndCheck(this.builder()//
                        .disable(ToStringBuilderOption.QUOTE)//
                .enable(ToStringBuilderOption.INLINE_ELEMENTS)//
                        .label(LABEL1)
                        .value(VALUE1) //
                        .label(LABEL2)
                        .value(new UsesToStringBuilder() {

                            @Override
                            public void buildToString(final ToStringBuilder builder) {
                                builder.separator("/")
                                        .labelSeparator(labelSeparator2)
                                        .separator(separator2)
                                        .valueSeparator(valueSeparator2)
                                        .enable(ToStringBuilderOption.QUOTE);
                                builder.value(value2);
                                builder.label(LABEL3).value(Lists.of(30, 31));
                            }
                        })//
                        .label(LABEL4)
                        .value(Lists.of(value4a, value4b)), //
                LABEL1 + LABEL_SEPARATOR + VALUE1 + SEPARATOR +
                        LABEL2 + LABEL_SEPARATOR + '"' + value2 + '"' + separator2 +
                        LABEL3 + labelSeparator2 + 30 + valueSeparator2 + 31 + SEPARATOR +
                        LABEL4 + LABEL_SEPARATOR + value4a + VALUE_SEPARATOR + value4b);
    }

Replace Anonymous With Lambda walkingkooka.ToStringBuilderAppenderUsesToStringBuilderScalarTest.testLabelUsesToStringBuilderChangesBuilderState2.buildAndCheck.value.label.value.new UsesToStringBuilder with builder -> {builder.separator("/").labelSeparator(labelSeparator2).separator(separator2).valueSeparator(valueSeparator2).enable(ToStringBuilderOption.QUOTE); in method public testLabelUsesToStringBuilderChangesBuilderState2() : void from class walkingkooka.ToStringBuilderAppenderUsesToStringBuilderScalarTest


    @Test
    public void testGlobalLengthValueFullValueUsesToStringBuilder() {
        this.buildAndCheckFull(this.createFullWithLabel()//
                .value(builder -> {
                    builder.globalLength(5);
                    assertEquals(5, builder.globalLength, "globalLength");
                    builder.value("IGNORED!");
                }));
    }

    @Test
    public void testGlobalLengthValueFullValueUsesToStringBuilder() {
        this.buildAndCheckFull(this.createFullWithLabel()//
                .value(new UsesToStringBuilder() {

                    @Override
                    public void buildToString(final ToStringBuilder builder) {
                        builder.globalLength(5);
                        assertEquals(5, builder.globalLength, "globalLength");
                        builder.value("IGNORED!");
                    }
                }));
    }

Replace Anonymous With Lambda walkingkooka.ToStringBuilderTest.testGlobalLengthValueFullValueUsesToStringBuilder.buildAndCheckFull.value.new UsesToStringBuilder with builder -> {builder.globalLength(5); in method public testGlobalLengthValueFullValueUsesToStringBuilder() : void from class walkingkooka.ToStringBuilderTest


    @Test
    public void testGlobalLengthValueFullValueUsesToStringBuilder2() {
        this.buildAndCheck(this.builder()//
                .globalLength(15)//
                .value("1234567890") //
                .value(builder -> {
                    builder.globalLength(100);
                    assertEquals(builder.buffer.length() + 100,
                            builder.globalLength,
                            "globalLength");
                    builder.value("abcdefghij");
                    builder.value("ignored");
                }), "1234567890abcde");
    }

    @Test
    public void testGlobalLengthValueFullValueUsesToStringBuilder2() {
        this.buildAndCheck(this.builder()//
                .globalLength(15)//
                .value("1234567890") //
                .value(new UsesToStringBuilder() {

                    @Override
                    public void buildToString(final ToStringBuilder builder) {
                        builder.globalLength(100);
                        assertEquals(builder.buffer.length() + 100,
                                builder.globalLength,
                                "globalLength");
                        builder.value("abcdefghij");
                        builder.value("ignored");
                    }
                }), "1234567890abcde");
    }

Replace Anonymous With Lambda walkingkooka.ToStringBuilderTest.testGlobalLengthValueFullValueUsesToStringBuilder2.buildAndCheck.value.new UsesToStringBuilder with builder -> {builder.globalLength(100); in method public testGlobalLengthValueFullValueUsesToStringBuilder2() : void from class walkingkooka.ToStringBuilderTest


    @Test
    public void testGlobalLengthValueFullValueUsesToStringBuilder3() {
        this.buildAndCheck(this.builder()//
                .globalLength(15)//
                .value("1234567890") //
                .value(builder -> {
                    builder.globalLength(5);
                    assertEquals(builder.buffer.length() + 5,
                            builder.globalLength,
                            "globalLength");

                    builder.globalLength(100);
                    assertEquals(builder.buffer.length() + 100,
                            builder.globalLength,
                            "globalLength");

                    builder.value("abcdefghij");
                    builder.value("ignored");
                }), "1234567890abcde");
    }

    @Test
    public void testGlobalLengthValueFullValueUsesToStringBuilder3() {
        this.buildAndCheck(this.builder()//
                .globalLength(15)//
                .value("1234567890") //
                .value(new UsesToStringBuilder() {

                    @Override
                    public void buildToString(final ToStringBuilder builder) {
                        builder.globalLength(5);
                        assertEquals(builder.buffer.length() + 5,
                                builder.globalLength,
                                "globalLength");

                        builder.globalLength(100);
                        assertEquals(builder.buffer.length() + 100,
                                builder.globalLength,
                                "globalLength");

                        builder.value("abcdefghij");
                        builder.value("ignored");
                    }
                }), "1234567890abcde");
    }

Replace Anonymous With Lambda walkingkooka.ToStringBuilderTest.testGlobalLengthValueFullValueUsesToStringBuilder3.buildAndCheck.value.new UsesToStringBuilder with builder -> {builder.globalLength(5); in method public testGlobalLengthValueFullValueUsesToStringBuilder3() : void from class walkingkooka.ToStringBuilderTest


    @Test
    public void testGlobalLengthValueLengthValueFullValueUsesToStringBuilder() {
        this.buildAndCheck(this.builder(5, 10)//
                .value(builder -> {
                    builder.valueLength(10);
                    assertEquals(5, builder.globalLength, "globalLength");
                    assertEquals(5, builder.valueLength, "valueLength");
                    builder.value("abcdefghij");
                }), "abcde");
    }

    @Test
    public void testGlobalLengthValueLengthValueFullValueUsesToStringBuilder() {
        this.buildAndCheck(this.builder(5, 10)//
                .value(new UsesToStringBuilder() {

                    @Override
                    public void buildToString(final ToStringBuilder builder) {
                        builder.valueLength(10);
                        assertEquals(5, builder.globalLength, "globalLength");
                        assertEquals(5, builder.valueLength, "valueLength");
                        builder.value("abcdefghij");
                    }
                }), "abcde");
    }

Replace Anonymous With Lambda walkingkooka.ToStringBuilderTest.testGlobalLengthValueLengthValueFullValueUsesToStringBuilder.buildAndCheck.value.new UsesToStringBuilder with builder -> {builder.valueLength(10); in method public testGlobalLengthValueLengthValueFullValueUsesToStringBuilder() : void from class walkingkooka.ToStringBuilderTest


    @Test
    public void testGlobalLengthValueLengthValueFullValueUsesToStringBuilder2() {
        this.buildAndCheck(this.builder()//
                .valueLength(10)//
                .value(builder -> {
                    builder.valueLength(5);
                    assertEquals(10, builder.globalLength, "globalLength");
                    assertEquals(5, builder.valueLength, "valueLength");

                    builder.value("abcdefghij");
                }), "abcde");
    }

    @Test
    public void testGlobalLengthValueLengthValueFullValueUsesToStringBuilder2() {
        this.buildAndCheck(this.builder()//
                .valueLength(10)//
                .value(new UsesToStringBuilder() {

                    @Override
                    public void buildToString(final ToStringBuilder builder) {
                        builder.valueLength(5);
                        assertEquals(10, builder.globalLength, "globalLength");
                        assertEquals(5, builder.valueLength, "valueLength");

                        builder.value("abcdefghij");
                    }
                }), "abcde");
    }

Replace Anonymous With Lambda walkingkooka.ToStringBuilderTest.testGlobalLengthValueLengthValueFullValueUsesToStringBuilder2.buildAndCheck.value.new UsesToStringBuilder with builder -> {builder.valueLength(5); in method public testGlobalLengthValueLengthValueFullValueUsesToStringBuilder2() : void from class walkingkooka.ToStringBuilderTest


    @Test
    public void testGlobalLengthValueLengthValueFullValueUsesToStringBuilder3() {
        this.buildAndCheck(this.builder()//
                .valueLength(10)//
                .value(builder -> {
                    builder.valueLength(5);
                    assertEquals(10, builder.globalLength, "globalLength");
                    assertEquals(5, builder.valueLength, "valueLength");

                    builder.value("abcdefghij");
                    builder.value("12345678");
                }), "abcde12345");
    }

    @Test
    public void testGlobalLengthValueLengthValueFullValueUsesToStringBuilder3() {
        this.buildAndCheck(this.builder()//
                .valueLength(10)//
                .value(new UsesToStringBuilder() {

                    @Override
                    public void buildToString(final ToStringBuilder builder) {
                        builder.valueLength(5);
                        assertEquals(10, builder.globalLength, "globalLength");
                        assertEquals(5, builder.valueLength, "valueLength");

                        builder.value("abcdefghij");
                        builder.value("12345678");
                    }
                }), "abcde12345");
    }

Replace Anonymous With Lambda walkingkooka.ToStringBuilderTest.testGlobalLengthValueLengthValueFullValueUsesToStringBuilder3.buildAndCheck.value.new UsesToStringBuilder with builder -> {builder.valueLength(5); in method public testGlobalLengthValueLengthValueFullValueUsesToStringBuilder3() : void from class walkingkooka.ToStringBuilderTest


    @Test
    public void testValueLengthUsesToStringBuilderValueLengthIncreases() {
        this.buildAndCheck(this.builder()//
                .valueLength(10)//
                .value(builder -> {
                    builder.valueLength(4);
                    builder.valueLength(5);
                    assertEquals(10, builder.globalLength, "globalLength");
                    assertEquals(5, builder.valueLength, "valueLength");

                    builder.value("abcdefghij");
                    builder.value("12345678");
                }), "abcde12345");
    }

    @Test
    public void testValueLengthUsesToStringBuilderValueLengthIncreases() {
        this.buildAndCheck(this.builder()//
                .valueLength(10)//
                .value(new UsesToStringBuilder() {

                    @Override
                    public void buildToString(final ToStringBuilder builder) {
                        builder.valueLength(4);
                        builder.valueLength(5);
                        assertEquals(10, builder.globalLength, "globalLength");
                        assertEquals(5, builder.valueLength, "valueLength");

                        builder.value("abcdefghij");
                        builder.value("12345678");
                    }
                }), "abcde12345");
    }

Replace Anonymous With Lambda walkingkooka.ToStringBuilderTest.testValueLengthUsesToStringBuilderValueLengthIncreases.buildAndCheck.value.new UsesToStringBuilder with builder -> {builder.valueLength(4); in method public testValueLengthUsesToStringBuilderValueLengthIncreases() : void from class walkingkooka.ToStringBuilderTest


    @Test
    public void testValueLengthUsesToStringBuilderValueLengthDecreaseIncrease() {
        this.buildAndCheck(this.builder()//
                .valueLength(10)//
                .value(builder -> {
                    builder.valueLength(4);
                    builder.valueLength(3);
                    builder.valueLength(5);
                    assertEquals(10, builder.globalLength, "globalLength");
                    assertEquals(5, builder.valueLength, "valueLength");

                    builder.value("abcdefghij");
                    builder.value("12345678");
                }), "abcde12345");
    }

    @Test
    public void testValueLengthUsesToStringBuilderValueLengthDecreaseIncrease() {
        this.buildAndCheck(this.builder()//
                .valueLength(10)//
                .value(new UsesToStringBuilder() {

                    @Override
                    public void buildToString(final ToStringBuilder builder) {
                        builder.valueLength(4);
                        builder.valueLength(3);
                        builder.valueLength(5);
                        assertEquals(10, builder.globalLength, "globalLength");
                        assertEquals(5, builder.valueLength, "valueLength");

                        builder.value("abcdefghij");
                        builder.value("12345678");
                    }
                }), "abcde12345");
    }

Replace Anonymous With Lambda walkingkooka.ToStringBuilderTest.testValueLengthUsesToStringBuilderValueLengthDecreaseIncrease.buildAndCheck.value.new UsesToStringBuilder with builder -> {builder.valueLength(4); in method public testValueLengthUsesToStringBuilderValueLengthDecreaseIncrease() : void from class walkingkooka.ToStringBuilderTest


    @Test
    public void testGlobalLengthValueLengthValueValueUsesToStringBuilderChops() {
        this.buildAndCheck(this.builder()//
                .globalLength(15)//
                .valueLength(5)//
                .value("1234567") //
                .value(builder -> {
                    assertEquals(5, builder.valueLength, "valueLength");
                    assertEquals(builder.buffer.length() + 5,
                            builder.globalLength,
                            "globalLength");

                    builder.value("abcdefghij"); // expected "abcde" to be added.
                    builder.value("IGNORED");
                })//
                .value("1234567"), "12345abcde12345");
    }

    @Test
    public void testGlobalLengthValueLengthValueValueUsesToStringBuilderChops() {
        this.buildAndCheck(this.builder()//
                .globalLength(15)//
                .valueLength(5)//
                .value("1234567") //
                .value(new UsesToStringBuilder() {

                    @Override
                    public void buildToString(final ToStringBuilder builder) {
                        assertEquals(5, builder.valueLength, "valueLength");
                        assertEquals(builder.buffer.length() + 5,
                                builder.globalLength,
                                "globalLength");

                        builder.value("abcdefghij"); // expected "abcde" to be added.
                        builder.value("IGNORED");
                    }
                })//
                .value("1234567"), "12345abcde12345");
    }

Replace Anonymous With Lambda walkingkooka.ToStringBuilderTest.testGlobalLengthValueLengthValueValueUsesToStringBuilderChops.buildAndCheck.value.value.new UsesToStringBuilder with builder -> {assertEquals(5,builder.valueLength,"valueLength"); in method public testGlobalLengthValueLengthValueValueUsesToStringBuilderChops() : void from class walkingkooka.ToStringBuilderTest