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

future-architect / uroborosql / #743

28 Jun 2024 04:17PM UTC coverage: 90.988% (+0.5%) from 90.484%
#743

push

web-flow
add paramIfNotEmpty method (#318)

* v0.x to master merge

* fix nanoseconds diff (java8 to java11)

* eclipse cleanup and  optimize import

* eclipse format

* optimize Imports

* remove unused annotation

* library version up

* migrate v0.x to master
- update java version 8 to 11
- update junit4 to junit5
- library version update

* fix test failed

* remove unused annotation

* fixed bug

* use var

* fix java8 coding style

* Refactoring TransactionContextManager

* Refactoring SqlAgent

* 途中コミット

* fix testcase

* fix review

* fix javadoc comments

* merge v0.x PR

* cleanup code

* cleanup test code

* change build status badge

* - agent.query, update, proc, batch にそれぞれSupplierを引数にとるメソッドを追加
- SqlQuery.paramとSqlEntityUpdate.setにFunctionを受け取るメソッドを追加

* testcaseの整形

* - SqlFluent と ExtractionCondition の分離
- Arrays.asList -> List.of への変更
- テストの整形

* - v0.x系の不具合対応の追いつき
- ログ出力の整理

* - SqlKindの整理(ENTITY_XXXの追加)
- REPL_LOGの追加
- Deprecatedメソッドの削除(SqlAgent)
- SqlAgent, ExecutionContextでsetterをfluent APIに変更

* DB接続URLの修正

* add and fix testcases.

* add event testcases.

* fix typo

* add paramIfNotEmpty method and StringUtils rename ObjectUtils

* fix review comments.

* remove unused import

1695 of 1958 new or added lines in 97 files covered. (86.57%)

26 existing lines in 10 files now uncovered.

8249 of 9066 relevant lines covered (90.99%)

0.91 hits per line

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

66.67
/src/main/java/jp/co/future/uroborosql/coverage/PassedRoute.java
1
/**
2
 * Copyright (c) 2017-present, Future Corporation
3
 *
4
 * This source code is licensed under the MIT license found in the
5
 * LICENSE file in the root directory of this source tree.
6
 */
7
package jp.co.future.uroborosql.coverage;
8

9
import java.util.ArrayList;
10
import java.util.Collection;
11
import java.util.Collections;
12
import java.util.Comparator;
13
import java.util.HashMap;
14
import java.util.List;
15
import java.util.Map;
16
import java.util.Map.Entry;
17
import java.util.stream.Collectors;
18

19
/**
20
 * 変換したSQLで評価された分岐情報
21
 *
22
 * @author ota
23
 */
24
public class PassedRoute {
1✔
25
        private final Map<Range, BranchCoverageState> passed = new HashMap<>();
1✔
26
        private final List<Range> hits = new ArrayList<>();
1✔
27
        private Ranges ranges;
28

29
        /**
30
         * 分岐情報追加
31
         *
32
         * @param start 開始位置(文字index)
33
         * @param end 終了位置(文字index)
34
         * @param state カバレッジ状態
35
         */
36
        public void appendBranchState(final int start, final int end, final BranchCoverageState state) {
37
                this.passed.put(new Range(start, end), state);
1✔
38
        }
1✔
39

40
        /**
41
         * 通過範囲の追加
42
         *
43
         * @param start 開始位置(文字index)
44
         * @param end 終了位置(文字index)
45
         */
46
        public void appendHitRange(final int start, final int end) {
47
                hits.add(new Range(start, end));
1✔
48
                ranges = null;//キャッシュをクリア
1✔
49
        }
1✔
50

51
        /**
52
         * 分岐情報取得
53
         *
54
         * @return 分岐情報
55
         */
56
        public Map<Integer, BranchCoverageState> getBranchStatus() {
UNCOV
57
                return passed.entrySet().stream()
×
UNCOV
58
                                .collect(Collectors.toUnmodifiableMap(entry -> entry.getKey().getStart(), Entry::getValue));
×
59
        }
60

61
        /**
62
         * 分岐情報取得
63
         *
64
         * @return 分岐情報
65
         */
66
        public Map<Range, BranchCoverageState> getRangeBranchStatus() {
67
                return Collections.unmodifiableMap(passed);
1✔
68
        }
69

70
        /**
71
         * 通過情報取得
72
         *
73
         * @return 通過情報
74
         */
75
        public Collection<Range> getHitRanges() {
76
                return Collections.unmodifiableCollection(getRanges());
1✔
77
        }
78

79
        /**
80
         * 指定した位置が通過した箇所かを判定する
81
         *
82
         * @param index 判定位置
83
         * @return 通過
84
         */
85
        public boolean isHit(final int index) {
86
                for (var range : getRanges()) {
×
87
                        if (range.contains(index)) {
×
88
                                return true;
×
89
                        }
90
                }
×
91
                return false;
×
92
        }
93

94
        /**
95
         * 指定した範囲が通過した箇所かを判定する
96
         *
97
         * @param target 判定範囲
98
         * @return 通過
99
         */
100
        public boolean isHit(final Range target) {
101
                for (var range : getRanges()) {
1✔
102
                        if (range.hasIntersection(target)) {
1✔
103
                                return true;
1✔
104
                        }
105
                }
1✔
106
                return false;
1✔
107
        }
108

109
        @Override
110
        public String toString() {
UNCOV
111
                return getBranchStatus().entrySet().stream().sorted(Comparator.comparingInt(Entry::getKey))
×
UNCOV
112
                                .map(e -> e.getKey() + ":" + e.getValue()).collect(Collectors.joining(",", "{", "}"));
×
113
        }
114

115
        private Ranges getRanges() {
116
                if (ranges == null) {
1✔
117
                        ranges = new Ranges(hits);
1✔
118
                }
119
                return ranges;
1✔
120
        }
121
}
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

© 2025 Coveralls, Inc