Skip to content

Commit

Permalink
[release] 🍎 release 1.9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
VampireAchao committed Jun 25, 2023
1 parent 6000c1f commit 275c067
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 42 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<revision>1.8.0</revision>
<revision>1.9.0</revision>
<maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
<maven-surefire-plugin.version>2.22.2</maven-surefire-plugin.version>
<maven-javadoc-plugin.version>3.4.0</maven-javadoc-plugin.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,12 @@ void eqTest() {
Database.updateFewSql(Lists.of(user));

QueryCondition<UserInfoWithJsonName> wrapper =
QueryCondition.query(UserInfoWithJsonName.class).eq(UserInfoWithJsonName::getName, name);
QueryCondition.query(UserInfoWithJsonName.class).eq(UserInfoWithJsonName::getName, name);
val list = Database.list(wrapper);

assertEquals(1, list.size(), "Query should return exactly one result");
assertEquals(
name, list.get(0).getName(), "Returned user's name should match the expected name");
name, list.get(0).getName(), "Returned user's name should match the expected name");
}

@Test
Expand All @@ -106,16 +106,16 @@ void activeEqTest() {
Database.saveFewSql(Lists.of(user));

QueryCondition<UserInfoWithJsonName> wrapper =
QueryCondition.query(UserInfoWithJsonName.class)
.activeEq(UserInfoWithJsonName::getName, name);
QueryCondition.query(UserInfoWithJsonName.class)
.activeEq(UserInfoWithJsonName::getName, name);

val list = Database.list(wrapper);

assertEquals(1, list.size(), "Query should return exactly one result");
assertEquals(
name.getUsername(),
list.get(0).getName().getUsername(),
"Returned user's username should match the expected username");
name.getUsername(),
list.get(0).getName().getUsername(),
"Returned user's username should match the expected username");
}

@Test
Expand Down Expand Up @@ -144,27 +144,27 @@ void orTest() {
Database.saveFewSql(Lists.of(user1, user2, user3));

QueryCondition<UserInfoWithJsonName> wrapper =
(QueryCondition<UserInfoWithJsonName>)
QueryCondition.query(UserInfoWithJsonName.class)
.in(UserInfoWithJsonName::getName, Lists.of(name1, name3))
.or(i -> i.eq(UserInfoWithJsonName::getName, user2.getName()));
(QueryCondition<UserInfoWithJsonName>)
QueryCondition.query(UserInfoWithJsonName.class)
.in(UserInfoWithJsonName::getName, Lists.of(name1, name3))
.or(i -> i.eq(UserInfoWithJsonName::getName, user2.getName()));

val list = Database.list(wrapper);

assertEquals(3, list.size(), "Query should return exactly two results");

List<String> usernames =
list.stream().map(user -> user.getName().getUsername()).collect(Collectors.toList());
list.stream().map(user -> user.getName().getUsername()).collect(Collectors.toList());

assertTrue(
usernames.contains(name1.getUsername()),
"Returned users should contain the first expected username");
usernames.contains(name1.getUsername()),
"Returned users should contain the first expected username");
assertTrue(
usernames.contains(name3.getUsername()),
"Returned users should contain the third expected username");
usernames.contains(name3.getUsername()),
"Returned users should contain the third expected username");
assertTrue(
usernames.contains(name2.getUsername()),
"Returned users should not contain the second username");
usernames.contains(name2.getUsername()),
"Returned users should not contain the second username");
}

@Test
Expand Down Expand Up @@ -193,25 +193,25 @@ void InTest() {
Database.saveFewSql(Lists.of(user1, user2, user3));

QueryCondition<UserInfoWithJsonName> wrapper =
QueryCondition.query(UserInfoWithJsonName.class)
.activeIn(UserInfoWithJsonName::getName, Lists.of(name1, name3));
QueryCondition.query(UserInfoWithJsonName.class)
.activeIn(UserInfoWithJsonName::getName, Lists.of(name1, name3));

val list = Database.list(wrapper);

assertEquals(2, list.size(), "Query should return exactly two results");

List<String> usernames =
list.stream().map(user -> user.getName().getUsername()).collect(Collectors.toList());
list.stream().map(user -> user.getName().getUsername()).collect(Collectors.toList());

assertTrue(
usernames.contains(name1.getUsername()),
"Returned users should contain the first expected username");
usernames.contains(name1.getUsername()),
"Returned users should contain the first expected username");
assertTrue(
usernames.contains(name3.getUsername()),
"Returned users should contain the third expected username");
usernames.contains(name3.getUsername()),
"Returned users should contain the third expected username");
assertFalse(
usernames.contains(name2.getUsername()),
"Returned users should not contain the second username");
usernames.contains(name2.getUsername()),
"Returned users should not contain the second username");
}

@Test
Expand Down Expand Up @@ -240,25 +240,25 @@ void activeInTest() {
Database.saveFewSql(Lists.of(user1, user2, user3));

QueryCondition<UserInfoWithJsonName> wrapper =
QueryCondition.query(UserInfoWithJsonName.class)
.activeIn(UserInfoWithJsonName::getName, Lists.of(name1, name3));
QueryCondition.query(UserInfoWithJsonName.class)
.activeIn(UserInfoWithJsonName::getName, Lists.of(name1, name3));

val list = Database.list(wrapper);

assertEquals(2, list.size(), "Query should return exactly two results");

List<String> usernames =
list.stream().map(user -> user.getName().getUsername()).collect(Collectors.toList());
list.stream().map(user -> user.getName().getUsername()).collect(Collectors.toList());

assertTrue(
usernames.contains(name1.getUsername()),
"Returned users should contain the first expected username");
usernames.contains(name1.getUsername()),
"Returned users should contain the first expected username");
assertTrue(
usernames.contains(name3.getUsername()),
"Returned users should contain the third expected username");
usernames.contains(name3.getUsername()),
"Returned users should contain the third expected username");
assertFalse(
usernames.contains(name2.getUsername()),
"Returned users should not contain the second username");
usernames.contains(name2.getUsername()),
"Returned users should not contain the second username");
}

@Test
Expand All @@ -273,17 +273,17 @@ void selectTest() {
Database.updateFewSql(Lists.of(user));

LambdaQueryWrapper<UserInfoWithJsonName> wrapper =
QueryCondition.query(UserInfoWithJsonName.class)
.select(UserInfoWithJsonName::getName)
.eq(UserInfoWithJsonName::getName, name);
QueryCondition.query(UserInfoWithJsonName.class)
.select(UserInfoWithJsonName::getName)
.eq(UserInfoWithJsonName::getName, name);
val list = Database.list(wrapper);
assertEquals(1, list.size(), "Query should return exactly one result");

UserInfoWithJsonName dbUser = list.get(0);
assertEquals(
user.getName().getUsername(), dbUser.getName().getUsername(), "Username should match");
user.getName().getUsername(), dbUser.getName().getUsername(), "Username should match");
assertEquals(
user.getName().getNickname(), dbUser.getName().getNickname(), "Nickname should match");
user.getName().getNickname(), dbUser.getName().getNickname(), "Nickname should match");
}

public static class JsonFieldHandler extends AbstractJsonFieldHandler<Object> {
Expand Down

0 comments on commit 275c067

Please sign in to comment.