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
16 final class EnforcerValidatorTest {
17
18
19
20
21
22
23
24 @Test
25 void skipsWhenEnforcerIsExcluded() throws Exception {
26 Assertions.assertDoesNotThrow(
27 () -> new EnforcerValidator().validate(
28 new MavenEnvironment.Wrap(
29 new EnforcerExcludedEnvironment(new Environment.Mock()),
30 new MavenEnvironmentMocker().mock()
31 )
32 ),
33 "Enforcer validator must not invoke executor when check is excluded"
34 );
35 }
36
37
38
39
40
41
42
43 @Test
44 void invokesExecutorWhenNotExcluded() throws Exception {
45 Assertions.assertThrows(
46 UnsupportedOperationException.class,
47 () -> new EnforcerValidator()
48 .validate(new MavenEnvironmentMocker().mock()),
49 "Enforcer validator must call executor when check is not excluded"
50 );
51 }
52 }