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

torand / FasterSQL / 13591799490

28 Feb 2025 03:59PM UTC coverage: 65.237% (-1.3%) from 66.563%
13591799490

push

github

web-flow
Merge pull request #14 from torand/having-support

feat: supporting the HAVING clause + IS NULL operator now supports an…

214 of 408 branches covered (52.45%)

Branch coverage included in aggregate %.

273 of 389 new or added lines in 69 files covered. (70.18%)

3 existing lines in 3 files now uncovered.

1079 of 1574 relevant lines covered (68.55%)

3.68 hits per line

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

83.33
/src/main/java/io/github/torand/fastersql/predicate/compound/And.java
1
/*
2
 * Copyright (c) 2024 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.Column;
19
import io.github.torand.fastersql.Context;
20
import io.github.torand.fastersql.Sql;
21
import io.github.torand.fastersql.alias.ColumnAlias;
22
import io.github.torand.fastersql.predicate.Predicate;
23

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

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

31
public class And implements Predicate {
32
    private final List<Predicate> operands;
33

34
    And(Predicate... operands) {
2✔
35
        this.operands = asList(requireNonEmpty(operands, "No operands specified"));
9✔
36
    }
1✔
37

38
    // Sql
39

40
    @Override
41
    public String sql(Context context) {
42
        return operands.stream()
6✔
43
            .map(e -> e instanceof Or ? "(" + e.sql(context) + ")" : e.sql(context))
14✔
44
            .collect(joining(" and "));
3✔
45
    }
46

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

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

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

62
    // Predicate
63

64
    @Override
65
    public String negatedSql(Context context) {
NEW
66
        return "not (" + sql(context) + ")";
×
67
    }
68
}
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