• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

torand / FasterSQL / 16597714186

29 Jul 2025 01:36PM UTC coverage: 72.977%. Remained the same
16597714186

push

github

torand
fix: add parentheses around negated predicate

234 of 378 branches covered (61.9%)

Branch coverage included in aggregate %.

0 of 1 new or added line in 1 file covered. (0.0%)

1308 of 1735 relevant lines covered (75.39%)

3.99 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

75.0
/src/main/java/io/github/torand/fastersql/predicate/compound/Or.java
1
/*
2
 * Copyright (c) 2024-2025 Tore Eide Andersen
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *      http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16
package io.github.torand.fastersql.predicate.compound;
17

18
import io.github.torand.fastersql.alias.ColumnAlias;
19
import io.github.torand.fastersql.model.Column;
20
import io.github.torand.fastersql.predicate.Predicate;
21
import io.github.torand.fastersql.sql.Context;
22
import io.github.torand.fastersql.sql.Sql;
23

24
import java.util.List;
25
import java.util.stream.Stream;
26

27
import static io.github.torand.javacommons.collection.CollectionHelper.asList;
28
import static io.github.torand.javacommons.contract.Requires.requireNonEmpty;
29
import static java.util.stream.Collectors.joining;
30

31
/**
32
 * Implements the compound predicate using the boolean operator OR on its operands.
33
 */
34
public class Or implements Predicate {
35
    private final List<Predicate> operands;
36

37
    Or(Predicate... operands) {
2✔
38
        this.operands = asList(requireNonEmpty(operands, "No operands specified"));
9✔
39
    }
1✔
40

41
    // Sql
42

43
    @Override
44
    public String sql(Context context) {
45
        return operands.stream().map(e -> e.sql(context)).collect(joining(" or "));
15✔
46
    }
47

48
    @Override
49
    public Stream<Object> params(Context context) {
50
        return operands.stream().flatMap(o -> o.params(context));
11✔
51
    }
52

53
    @Override
54
    public Stream<Column> columnRefs() {
55
        return operands.stream().flatMap(Sql::columnRefs);
6✔
56
    }
57

58
    @Override
59
    public Stream<ColumnAlias> aliasRefs() {
60
        return operands.stream().flatMap(Sql::aliasRefs);
×
61
    }
62

63
    // Predicate
64

65
    @Override
66
    public String negatedSql(Context context) {
NEW
67
        return "not (" + sql(context) + ")";
×
68
    }
69
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc