Skip to content

Commit 4ee4577

Browse files
committed
[wenhao] increase unit test coverage.
1 parent 0b170f6 commit 4ee4577

File tree

5 files changed

+11
-15
lines changed

5 files changed

+11
-15
lines changed

config/githooks/commit-msg

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,13 @@
11
#!/usr/bin/env bash
22

3-
# Color codes
4-
red='\033[0;31m'
5-
yellow='\033[0;33m'
6-
blue='\033[0;34m'
7-
NC='\033[0m' # No colors
8-
93
# Regex & Usage
104
commit_regex="^(\[\S+(\s\&\s\S+)*\]|merge)\s"
115
error_message="Aborting commit. Commit message must start with [YOUR NAME]."
126
usage="[YOUR NAME] Commit Message."
137

148
if ! grep -qE "$commit_regex" "$1"; then
15-
printf "${red}$error_message\n"
16-
printf "${yellow}Commit Regex: ${NC}${commit_regex}\n"
17-
printf "${red}Usage: ${NC}${usage}\n"
9+
printf "error_message\n"
10+
printf "Commit Regex: ${commit_regex}\n"
11+
printf "Usage: ${usage}\n"
1812
exit 1
1913
fi

config/githooks/pre-push

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
#!/usr/bin/env bash
22

3-
# Color codes
4-
red='\033[0;31m'
5-
yellow='\033[0;33m'
6-
73
command="./gradlew build"
84

95
${command}
106

117
if ! [ $? -eq 0 ]; then
12-
printf "${red}Make sure successfully execute command: ${yellow}$command${red}."
8+
printf "Make sure successfully execute command: $command."
139
exit 1
1410
fi

src/test/java/com/github/wenhao/jpa/integration/InTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,12 @@ public void should_be_able_to_find_by_using_in() {
4646
// given
4747
Person jack = new PersonBuilder()
4848
.name("Jack")
49+
.nickName("Jack")
4950
.age(18)
5051
.build();
5152
Person eric = new PersonBuilder()
5253
.name("Eric")
54+
.nickName("Eric")
5355
.age(20)
5456
.build();
5557
personRepository.save(jack);
@@ -58,6 +60,7 @@ public void should_be_able_to_find_by_using_in() {
5860
// when
5961
Specification<Person> specification = Specifications.<Person>and()
6062
.in(isNotBlank(jack.getName()), "name", Arrays.asList("Jack", "Eric"))
63+
.in("name", Arrays.asList("Jack", "Eric"))
6164
.build();
6265

6366
List<Person> persons = personRepository.findAll(specification);

src/test/java/com/github/wenhao/jpa/integration/NotInTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,12 @@ public void should_be_able_to_find_by_using_in() {
4646
// given
4747
Person jack = new PersonBuilder()
4848
.name("Jack")
49+
.nickName("Jack")
4950
.age(18)
5051
.build();
5152
Person eric = new PersonBuilder()
5253
.name("Eric")
54+
.nickName("Eric")
5355
.age(20)
5456
.build();
5557
personRepository.save(jack);
@@ -58,6 +60,7 @@ public void should_be_able_to_find_by_using_in() {
5860
// when
5961
Specification<Person> specification = Specifications.<Person>and()
6062
.notIn(isNotBlank(jack.getName()), "name", Arrays.asList("Eric"))
63+
.notIn("nickName", Arrays.asList("Eric"))
6164
.build();
6265

6366
List<Person> persons = personRepository.findAll(specification);

src/test/java/com/github/wenhao/jpa/integration/NotLikeTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public void should_be_able_to_find_by_using_not_like() {
5959
// when
6060
Specification<Person> specification = Specifications.<Person>and()
6161
.notLike(isNotBlank(jack.getName()), "name", "%ac%")
62-
.notLike(isNotBlank(jack.getNickName()), "name", "%og%", "%ri%")
62+
.notLike("name", "%og%", "%ri%")
6363
.build();
6464

6565
List<Person> persons = personRepository.findAll(specification);

0 commit comments

Comments
 (0)