Skip to content

Commit 4e97c65

Browse files
committed
test: add ValidationConfigTest to assert beforeCheckpoint and afterRestore hooks do not throw exception
1 parent da42c49 commit 4e97c65

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* Copyright 2023 Amazon.com, Inc. or its affiliates.
3+
* Licensed under the Apache License, Version 2.0 (the
4+
* "License"); you may not use this file except in compliance
5+
* with the License. You may obtain a copy of the License at
6+
* http://www.apache.org/licenses/LICENSE-2.0
7+
* Unless required by applicable law or agreed to in writing, software
8+
* distributed under the License is distributed on an "AS IS" BASIS,
9+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
* See the License for the specific language governing permissions and
11+
* limitations under the License.
12+
*
13+
*/
14+
15+
package software.amazon.lambda.powertools.validation;
16+
17+
import static org.assertj.core.api.Assertions.assertThatNoException;
18+
import static org.mockito.Mockito.mock;
19+
20+
import org.crac.Context;
21+
import org.crac.Resource;
22+
import org.junit.jupiter.api.Test;
23+
24+
public class ValidationConfigTest {
25+
26+
ValidationConfig config = ValidationConfig.get();
27+
Context<Resource> context = mock(Context.class);
28+
29+
@Test
30+
public void testBeforeCheckpointDoesNotThrowException() {
31+
assertThatNoException().isThrownBy(() -> config.beforeCheckpoint(context));
32+
}
33+
34+
@Test
35+
public void testAfterRestoreDoesNotThrowException() {
36+
assertThatNoException().isThrownBy(() -> config.afterRestore(context));
37+
}
38+
}

0 commit comments

Comments
 (0)