@Test void testValidatePackageParentOk() { Package packageParent = when(mock(Package.class).getId()).thenReturn("parent").getMock(); Package aPackage = when(mock(Package.class).getId()).thenReturn("child").getMock(); when(aPackage.getParent()).thenReturn(packageParent); packageValidator.validate(aPackage, ValidationMode.ADD); }
public void validate(Package aPackage, ValidationMode validationMode) { validatePackageAllowed(aPackage, validationMode); runAsSystem(() -> validatePackageParent(aPackage)); }
PackageValidator { public void validate(Package aPackage, ValidationMode validationMode) { validatePackageAllowed(aPackage, validationMode); runAsSystem(() -> validatePackageParent(aPackage)); } }
PackageValidator { public void validate(Package aPackage, ValidationMode validationMode) { validatePackageAllowed(aPackage, validationMode); runAsSystem(() -> validatePackageParent(aPackage)); } PackageValidator(SystemPackageRegistry systemPackageRegistry); }
PackageValidator { public void validate(Package aPackage, ValidationMode validationMode) { validatePackageAllowed(aPackage, validationMode); runAsSystem(() -> validatePackageParent(aPackage)); } PackageValidator(SystemPackageRegistry systemPackageRegistry); void validate(Package aPackage, ValidationMode validationMode); }
PackageValidator { public void validate(Package aPackage, ValidationMode validationMode) { validatePackageAllowed(aPackage, validationMode); runAsSystem(() -> validatePackageParent(aPackage)); } PackageValidator(SystemPackageRegistry systemPackageRegistry); void validate(Package aPackage, ValidationMode validationMode);  }