// Path: src/main/java/org/simplify4u/plugins/utils/MavenCompilerUtils.java
// public static boolean checkCompilerPlugin(Plugin plugin) {
//     return GROUPID.equals(plugin.getGroupId()) && ARTIFACTID.equals(plugin.getArtifactId());
// }
// 
// Path: src/main/java/org/simplify4u/plugins/utils/MavenCompilerUtils.java
// public static Set<Artifact> extractAnnotationProcessors(RepositorySystem system, Plugin plugin) {
//     requireNonNull(system);
//     if (!checkCompilerPlugin(plugin)) {
//         throw new IllegalArgumentException("Plugin is not '" + GROUPID + ":" + ARTIFACTID + "'.");
//     }
//     final Object config = plugin.getConfiguration();
//     if (config == null) {
//         return emptySet();
//     }
//     if (config instanceof Xpp3Dom) {
//         return stream(((Xpp3Dom) config).getChildren("annotationProcessorPaths"))
//                 .flatMap(aggregate -> stream(aggregate.getChildren("path")))
//                 .map(processor -> system.createArtifact(
//                         extractChildValue(processor, "groupId"),
//                         extractChildValue(processor, "artifactId"),
//                         extractChildValue(processor, "version"),
//                         PACKAGING))
//                 // A path specification is automatically ignored in maven-compiler-plugin if version is absent,
//                 // therefore there is little use in logging incomplete paths that are filtered out.
//                 .filter(a -> !a.getGroupId().isEmpty())
//                 .filter(a -> !a.getArtifactId().isEmpty())
//                 .filter(a -> !a.getVersion().isEmpty())
//                 .collect(Collectors.toSet());
//     }
//     // It is expected that this will never occur due to all Configuration instances of all plugins being provided as
//     // XML document. If this happens to occur on very old plugin versions, we can safely add the type support and
//     // simply return an empty set.
//     throw new UnsupportedOperationException("Please report that an unsupported type of configuration container" +
//             " was encountered: " + config.getClass());
// }


import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertThrows;
import static org.testng.Assert.assertTrue;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.model.Plugin;
import org.apache.maven.repository.RepositorySystem;
import org.codehaus.plexus.util.xml.Xpp3Dom;
import org.testng.annotations.Test;
import java.util.Set;
import static java.util.Collections.emptySet;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import static org.simplify4u.plugins.utils.MavenCompilerUtils.checkCompilerPlugin;
import static org.simplify4u.plugins.utils.MavenCompilerUtils.extractAnnotationProcessors;
import static org.testng.Assert.assertEquals;
/*
 * Copyright 2019 Danny van Heumen
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.simplify4u.plugins.utils;




@SuppressWarnings({"ConstantConditions", "SameParameterValue"})
public final class MavenCompilerUtilsTest {

    @Test
    public void testCheckCompilerPlugin() {
// Path: src/main/java/org/simplify4u/plugins/utils/MavenCompilerUtils.java
// public static boolean checkCompilerPlugin(Plugin plugin) {
//     return GROUPID.equals(plugin.getGroupId()) && ARTIFACTID.equals(plugin.getArtifactId());
// }
// 
// Path: src/main/java/org/simplify4u/plugins/utils/MavenCompilerUtils.java
// public static Set<Artifact> extractAnnotationProcessors(RepositorySystem system, Plugin plugin) {
//     requireNonNull(system);
//     if (!checkCompilerPlugin(plugin)) {
//         throw new IllegalArgumentException("Plugin is not '" + GROUPID + ":" + ARTIFACTID + "'.");
//     }
//     final Object config = plugin.getConfiguration();
//     if (config == null) {
//         return emptySet();
//     }
//     if (config instanceof Xpp3Dom) {
//         return stream(((Xpp3Dom) config).getChildren("annotationProcessorPaths"))
//                 .flatMap(aggregate -> stream(aggregate.getChildren("path")))
//                 .map(processor -> system.createArtifact(
//                         extractChildValue(processor, "groupId"),
//                         extractChildValue(processor, "artifactId"),
//                         extractChildValue(processor, "version"),
//                         PACKAGING))
//                 // A path specification is automatically ignored in maven-compiler-plugin if version is absent,
//                 // therefore there is little use in logging incomplete paths that are filtered out.
//                 .filter(a -> !a.getGroupId().isEmpty())
//                 .filter(a -> !a.getArtifactId().isEmpty())
//                 .filter(a -> !a.getVersion().isEmpty())
//                 .collect(Collectors.toSet());
//     }
//     // It is expected that this will never occur due to all Configuration instances of all plugins being provided as
//     // XML document. If this happens to occur on very old plugin versions, we can safely add the type support and
//     // simply return an empty set.
//     throw new UnsupportedOperationException("Please report that an unsupported type of configuration container" +
//             " was encountered: " + config.getClass());
// }


// Path: src/test/java/org/simplify4u/plugins/utils/MavenCompilerUtilsTest.java
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertThrows;
import static org.testng.Assert.assertTrue;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.model.Plugin;
import org.apache.maven.repository.RepositorySystem;
import org.codehaus.plexus.util.xml.Xpp3Dom;
import org.testng.annotations.Test;
import java.util.Set;
import static java.util.Collections.emptySet;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import static org.simplify4u.plugins.utils.MavenCompilerUtils.checkCompilerPlugin;
import static org.simplify4u.plugins.utils.MavenCompilerUtils.extractAnnotationProcessors;
import static org.testng.Assert.assertEquals;

/*
 * Copyright 2019 Danny van Heumen
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.simplify4u.plugins.utils;




@SuppressWarnings({"ConstantConditions", "SameParameterValue"})
public final class MavenCompilerUtilsTest {

    @Test
    public void testCheckCompilerPlugin() {
        assertThrows(NullPointerException.class, () -> checkCompilerPlugin(null));