1
2
3
4
5 package com.qulice.maven;
6
7 import com.qulice.spi.Environment;
8 import org.junit.jupiter.api.Assertions;
9 import org.junit.jupiter.api.Test;
10
11
12
13
14
15 final class EnforcerValidatorTest {
16
17
18
19
20
21
22 @Test
23 void skipsWhenEnforcerIsExcluded() throws Exception {
24 Assertions.assertDoesNotThrow(
25 () -> new EnforcerValidator().validate(
26 new MavenEnvironment.Wrap(
27 new EnforcerExcludedEnvironment(new Environment.Mock()),
28 new MavenEnvironmentMocker().mock()
29 )
30 ),
31 "Enforcer validator must not invoke executor when check is excluded"
32 );
33 }
34
35
36
37
38
39
40 @Test
41 void invokesExecutorWhenNotExcluded() throws Exception {
42 Assertions.assertThrows(
43 UnsupportedOperationException.class,
44 () -> new EnforcerValidator()
45 .validate(new MavenEnvironmentMocker().mock()),
46 "Enforcer validator must call executor when check is not excluded"
47 );
48 }
49 }