### Question:
DependencyUtils { public static boolean hasDependency(final PluginContext context, final EssentialsDependency dependency) { final TargetPom targetPom = dependency.getDependencyTargetPom(); if (targetPom == TargetPom.INVALID) { return false; } final Model model = ProjectUtils.getPomModel(context, targetPom); final List<Dependency> dependencies = model.getDependencies(); for (Dependency projectDependency : dependencies) { final boolean isSameDependency = isSameDependency(dependency, projectDependency); if (isSameDependency) { final String ourVersion = dependency.getVersion(); if (Strings.isNullOrEmpty(ourVersion)) { return true; } final String currentVersion = projectDependency.getVersion(); if (Strings.isNullOrEmpty(currentVersion) || currentVersion.indexOf('$') != -1) { log.warn("Current version couldn't be resolved {}", currentVersion); return true; } return VersionUtils.compareVersionNumbers(currentVersion, ourVersion) >= 0; } } return false; } private  DependencyUtils(); static boolean addRepository(final PluginContext context, final Repository repository); static boolean writePom(final String path, final Model model); static boolean removeDependency(final PluginContext context, final EssentialsDependency dependency); static boolean addDependency(final PluginContext context, final EssentialsDependency dependency); static boolean hasRepository(final PluginContext context, final Repository repository); static boolean hasDependency(final PluginContext context, final EssentialsDependency dependency); static boolean upgradeToEnterpriseProject(final PluginContext context); static boolean isEnterpriseProject(final PluginContext context); static final String DEFAULT_ID; }### Answer:
@Test public void testHasDependency() throws Exception { final EssentialsDependency dependency = new DependencyRestful(); dependency.setTargetPom("cms"); dependency.setArtifactId("hippo-plugins-shared"); dependency.setVersion("1.01.00-SNAPSHOT"); dependency.setGroupId("org.onehippo.cms7.essentials"); assertEquals(TargetPom.CMS, dependency.getDependencyTargetPom()); final boolean hasDep = DependencyUtils.hasDependency(getContext(), dependency); assertTrue("Expected hippo-plugins-shared version", hasDep); }