Skip to content

Commit 7af3679

Browse files
committed
codes: 更新示例代码
1 parent 74afe2b commit 7af3679

File tree

9 files changed

+338
-315
lines changed

9 files changed

+338
-315
lines changed

codes/javatech/javatech-lib/pom.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<name>JAVATECH-工具包示例</name>
1717

1818
<properties>
19-
<poi.version>4.0.0</poi.version>
19+
<poi.version>5.2.2</poi.version>
2020
<jmh.version>1.22</jmh.version>
2121
</properties>
2222

@@ -53,7 +53,7 @@
5353
<dependency>
5454
<groupId>com.esotericsoftware</groupId>
5555
<artifactId>kryo</artifactId>
56-
<version>5.0.0-RC4</version>
56+
<version>5.3.0</version>
5757
</dependency>
5858

5959
<!--日志工具包-->
@@ -73,7 +73,7 @@
7373
<dependency>
7474
<groupId>com.squareup.okhttp3</groupId>
7575
<artifactId>okhttp</artifactId>
76-
<version>4.9.3</version>
76+
<version>4.10.0</version>
7777
</dependency>
7878

7979
<!-- OFFICE文件解析工具包 -->
@@ -97,7 +97,7 @@
9797
<dependency>
9898
<groupId>com.alibaba</groupId>
9999
<artifactId>easyexcel</artifactId>
100-
<version>2.2.6</version>
100+
<version>3.1.1</version>
101101
</dependency>
102102

103103
<!--xml解析工具包-->
@@ -111,7 +111,7 @@
111111
<dependency>
112112
<groupId>com.github.javaparser</groupId>
113113
<artifactId>javaparser-symbol-solver-core</artifactId>
114-
<version>3.24.0</version>
114+
<version>3.24.2</version>
115115
</dependency>
116116

117117
<!--汉字转拼音-->
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package io.github.dunwu.javatech.test.junit5;
2+
3+
import org.assertj.core.api.Assertions;
4+
import org.junit.jupiter.api.Test;
5+
6+
/**
7+
* assertj Assertions 示例
8+
* @author <a href="mailto:[email protected]">Zhang Peng</a>
9+
* @date 2022-07-29
10+
*/
11+
public class AassertjAssertionsTests {
12+
13+
@Test
14+
void exceptionTesting() {
15+
Throwable exception = Assertions.catchThrowable(() -> {
16+
throw new IllegalArgumentException("a message");
17+
});
18+
Assertions.assertThat(exception.getMessage()).isEqualTo("a message");
19+
}
20+
21+
@Test
22+
void standardAssertions() {
23+
Assertions.assertThat(2).isEqualTo(2);
24+
Assertions.assertThat('a').isLessThan('b');
25+
}
26+
}

codes/javatech/javatech-lib/src/test/java/io/github/dunwu/javatech/test/junit5/DynamicTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Stream<DynamicTest> dynamicTestsFromIntStream() {
3535
// Generates tests for the first 10 even integers.
3636
return IntStream.iterate(0, n -> n + 2)
3737
.limit(10)
38-
.mapToObj(n -> dynamicTest("test" + n, () -> assertTrue(n % 2 == 0)));
38+
.mapToObj(n -> dynamicTest("test" + n, () -> assertEquals(0, n % 2)));
3939
}
4040

4141
@TestFactory

codes/javatech/javatech-lib/src/test/java/io/github/dunwu/javatech/test/junit5/RepeatedTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ void beforeEach(TestInfo testInfo, RepetitionInfo repetitionInfo) {
1212
int currentRepetition = repetitionInfo.getCurrentRepetition();
1313
int totalRepetitions = repetitionInfo.getTotalRepetitions();
1414
String methodName = testInfo.getTestMethod().get().getName();
15-
System.out.println(String.format("About to execute repetition %d of %d for %s", //
16-
currentRepetition, totalRepetitions, methodName));
15+
System.out.printf("About to execute repetition %d of %d for %s%n", //
16+
currentRepetition, totalRepetitions, methodName);
1717
}
1818

1919
@RepeatedTest(value = 1, name = "{displayName} {currentRepetition}/{totalRepetitions}")

codes/javatech/javatech-server/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<dependency>
3030
<groupId>org.logback-extensions</groupId>
3131
<artifactId>logback-ext-spring</artifactId>
32-
<version>0.1.2</version>
32+
<version>0.1.5</version>
3333
</dependency>
3434
<dependency>
3535
<groupId>org.slf4j</groupId>

0 commit comments

Comments
 (0)