### Question:
LegacyMojoWhitelist implements MojoExecutionListener { boolean isExecutionWhitelisted(String key, String executionId, String projectGroupId, String projectArtifactId) { if (!whitelist.containsKey(key)) { return false; } Set<String> executions = whitelist.get(key); if (executions.isEmpty()) { return true; } return executions.contains(executionKey(executionId, projectGroupId, projectArtifactId)) || executions.contains(executionKey(executionId, "*", "*")); } @Inject  LegacyMojoWhitelist(MavenSession session);   LegacyMojoWhitelist(Path configFile); @Override void beforeMojoExecution(MojoExecutionEvent event); @Override void afterMojoExecutionSuccess(MojoExecutionEvent event); @Override void afterExecutionFailure(MojoExecutionEvent event); static final String FILE_WHITELIST; }### Answer:
@Test public void testExecutionWhitelist() throws Exception { LegacyMojoWhitelist testee = new LegacyMojoWhitelist(newConfig("g:a:g1:e:pg:pa")); assertTrue(testee.isExecutionWhitelisted("g:a:g1", "e", "pg", "pa")); assertFalse(testee.isExecutionWhitelisted("g:a:g1", "e1", "pg", "pa")); assertFalse(testee.isExecutionWhitelisted("g:a:g1", "e", "pg1", "pa")); assertFalse(testee.isExecutionWhitelisted("g:a:g1", "e", "pg", "pa1")); }
@Test public void testExecutionWhitelistNoExecutionSpecified() throws Exception { LegacyMojoWhitelist testee = new LegacyMojoWhitelist(newConfig("g:a:g1")); assertTrue(testee.isExecutionWhitelisted("g:a:g1", "e", "pg", "pa")); }
@Test public void testExecutionWhitelistWildcard() throws Exception { LegacyMojoWhitelist testee = new LegacyMojoWhitelist(newConfig("g:a:g1:e:*:*")); assertTrue(testee.isExecutionWhitelisted("g:a:g1", "e", "pg", "pa")); assertTrue(testee.isExecutionWhitelisted("g:a:g1", "e", "pg1", "pa")); assertTrue(testee.isExecutionWhitelisted("g:a:g1", "e", "pg", "pa1")); assertFalse(testee.isExecutionWhitelisted("g:a:g1", "e1", "pg", "pa")); }