@Test
public void testGetOakpalCoreVersion() {

    final OpearPackageMojo mojo = newMojo();
    final MavenProject project = mock(MavenProject.class);
    mojo.project = project;
    final MavenSession session = mock(MavenSession.class);
    mojo.session = session;
    final MavenExecutionRequest executionRequest = mock(MavenExecutionRequest.class);
    when(session.getRequest()).thenReturn(executionRequest);
    final String expectVersion = "0.31415926535898";
    final Dependency oakpalCoreDep = new DependencyFilter()
            .withGroupId(OAKPAL_GROUP_ID)
            .withArtifactId(OAKPAL_CORE_ARTIFACT_ID)
            .withVersion(expectVersion)
            .toDependency();
    when(project.getDependencies()).thenReturn(Collections.singletonList(oakpalCoreDep));
    final RepositorySystem repositorySystem = mock(RepositorySystem.class);
    mojo.repositorySystem = repositorySystem;
    final Artifact oakpalCoreArt = mock(Artifact.class);
    final ArtifactResolutionResult result = mock(ArtifactResolutionResult.class);
    when(result.getArtifacts()).thenReturn(Collections.singleton(oakpalCoreArt));
    when(oakpalCoreArt.getGroupId()).thenReturn(OAKPAL_GROUP_ID);
    when(oakpalCoreArt.getArtifactId()).thenReturn(OAKPAL_CORE_ARTIFACT_ID);
    when(oakpalCoreArt.getVersion()).thenReturn(expectVersion);
    when(repositorySystem.createDependencyArtifact(oakpalCoreDep)).thenReturn(oakpalCoreArt);
    doAnswer(call -> {
        final ArtifactResolutionRequest request = call.getArgument(0, ArtifactResolutionRequest.class);
        if (request.getArtifact() == oakpalCoreArt) {
            return result;
        } else {
            return null;
        }
    }).when(repositorySystem).resolve(any(ArtifactResolutionRequest.class));
    assertEquals("expect version", expectVersion, mojo.getOakpalCoreVersion());
}