Skip to content

Commit

Permalink
增加populate
Browse files Browse the repository at this point in the history
  • Loading branch information
leaderli committed Nov 15, 2024
1 parent 9cc9ec4 commit 1ef9373
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public T args(Object... compareArgs) {
return (T) this;
}

public T assertThrow(Class<? extends Throwable> exceptionClass) {
public T assertThrowException(Class<? extends Throwable> exceptionClass) {
add((method, args, _return) -> Assertions.assertSame(_return.getClass(), exceptionClass));
return (T) this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ default B call(T call) {

B args(Object... args);

B assertThrow(Class<? extends Throwable> exceptionClass);
B assertThrowException(Class<? extends Throwable> exceptionClass);

B assertReturn(Object compareReturn);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ public RecordBeans<T> args(Object... args) {
return this;
}

public RecordBeans<T> assertThrow(Class<? extends Throwable> exceptionClass) {
recordBeans.forEach(r -> r.assertThrow(exceptionClass));
@Override
public RecordBeans<T> assertThrowException(Class<? extends Throwable> exceptionClass) {
recordBeans.forEach(r -> r.assertThrowException(exceptionClass));
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -638,12 +638,12 @@ void testRecordException() throws Exception {


LiMock.recorder(RecordError.class).run(() -> recordError.get2(3))
.assertThrow(IllegalStateException.class)
.assertThrowException(IllegalStateException.class)
.build();
Assertions.assertThrows(AssertionFailedError.class, () -> recordError.get2(1));
LiMock.reset(RecordError.class);
LiMock.recorder(RecordError.class).run(() -> recordError.get2(3))
.assertThrow(RuntimeException.class)
.assertThrowException(RuntimeException.class)
.build();
Assertions.assertThrows(RuntimeException.class, () -> recordError.get2(1));

Expand Down

0 comments on commit 1ef9373

Please sign in to comment.