-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #180 from eclipse-passage/561435-2
561435 API revision: requirements resolution: test coverage
- Loading branch information
Showing
18 changed files
with
399 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
...src/org/eclipse/passage/lic/internal/equinox/requirements/CapabilityLicFeatureIdTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2020 ArSysOp | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* https://www.eclipse.org/legal/epl-2.0/. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* ArSysOp - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.passage.lic.internal.equinox.requirements; | ||
|
||
import java.util.Arrays; | ||
import java.util.HashSet; | ||
import java.util.Map; | ||
import java.util.Set; | ||
|
||
import org.eclipse.passage.lic.internal.base.StringNamedData; | ||
|
||
@SuppressWarnings("restriction") | ||
public final class CapabilityLicFeatureIdTest extends CapabilityLicFeatureInfoTest { | ||
|
||
@Override | ||
protected StringNamedData infoSupplier(Map<String, Object> attributes) { | ||
return new CapabilityLicFeatureId(attributes); | ||
} | ||
|
||
@Override | ||
protected Set<String> expectations() { | ||
return new HashSet<String>(Arrays.asList(// | ||
"PI", //$NON-NLS-1$ | ||
"E" //$NON-NLS-1$ | ||
)); | ||
} | ||
|
||
} |
60 changes: 60 additions & 0 deletions
60
...c/org/eclipse/passage/lic/internal/equinox/requirements/CapabilityLicFeatureInfoTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2020 ArSysOp | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* https://www.eclipse.org/legal/epl-2.0/. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* ArSysOp - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.passage.lic.internal.equinox.requirements; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertFalse; | ||
|
||
import java.util.Collections; | ||
import java.util.Map; | ||
import java.util.Optional; | ||
import java.util.Set; | ||
import java.util.stream.Collectors; | ||
|
||
import org.eclipse.passage.lic.internal.base.StringNamedData; | ||
import org.junit.Test; | ||
import org.osgi.framework.wiring.BundleCapability; | ||
|
||
@SuppressWarnings("restriction") | ||
abstract class CapabilityLicFeatureInfoTest { | ||
|
||
@Test | ||
public void read() { | ||
DataBundle data = new DataBundle(); | ||
assertEquals(// | ||
expectations(), // $NON-NLS-1$ | ||
data.capabilities().stream()// | ||
.map(BundleCapability::getAttributes) // | ||
.map(this::infoSupplier) // | ||
.map(StringNamedData::get) // | ||
.filter(Optional::isPresent)// | ||
.map(Optional::get) // | ||
.collect(Collectors.toSet())// | ||
); | ||
} | ||
|
||
@Test(expected = NullPointerException.class) | ||
public void nullInputMap() { | ||
infoSupplier(null).get(); | ||
} | ||
|
||
@Test | ||
public void nullInputValue() { | ||
assertFalse(infoSupplier(Collections.emptyMap()).get().isPresent()); | ||
} | ||
|
||
protected abstract StringNamedData infoSupplier(Map<String, Object> attributes); | ||
|
||
protected abstract Set<String> expectations(); | ||
|
||
} |
38 changes: 38 additions & 0 deletions
38
...c/org/eclipse/passage/lic/internal/equinox/requirements/CapabilityLicFeatureNameTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2020 ArSysOp | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* https://www.eclipse.org/legal/epl-2.0/. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* ArSysOp - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.passage.lic.internal.equinox.requirements; | ||
|
||
import java.util.Arrays; | ||
import java.util.HashSet; | ||
import java.util.Map; | ||
import java.util.Set; | ||
|
||
import org.eclipse.passage.lic.internal.base.StringNamedData; | ||
|
||
@SuppressWarnings("restriction") | ||
public final class CapabilityLicFeatureNameTest extends CapabilityLicFeatureInfoTest { | ||
|
||
@Override | ||
protected StringNamedData infoSupplier(Map<String, Object> attributes) { | ||
return new CapabilityLicFeatureName(attributes); | ||
} | ||
|
||
@Override | ||
protected Set<String> expectations() { | ||
return new HashSet<String>(Arrays.asList(// | ||
"PI of version PI", //$NON-NLS-1$ | ||
"Euler number" //$NON-NLS-1$ | ||
)); | ||
} | ||
|
||
} |
Oops, something went wrong.