Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/*******************************************************************************
* SysML 2 Pilot Implementation
* Copyright (c) 2021-2022, 2024-2026 Model Driven Solutions, Inc.
*
* Copyright (c) 2026 Obeo
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the Eclipse Public License as published by
* the Eclipse Foundation, version 2 of the License.
Expand Down Expand Up @@ -228,6 +229,9 @@ public static List<Feature> getOwnedParametersOf(Type type) {
if (type instanceof Feature) {
type = FeatureUtil.getBasicFeatureOf((Feature)type);
}
if (type == null) {
return new ArrayList<>();
}
return type.getOwnedFeature().stream().
filter(FeatureUtil::isParameter).
collect(Collectors.toList());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*******************************************************************************
* SysML 2 Pilot Implementation
* Copyright (c) 2026 Obeo
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the Eclipse Public License as published by
* the Eclipse Foundation, version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* Eclipse Public License for more details.
*
* You should have received a copy of theEclipse Public License
* along with this program. If not, see <https://www.eclipse.org/legal/epl-2.0/>.
*
* @license EPL-2.0 <http://spdx.org/licenses/EPL-2.0>
*
*******************************************************************************/

package org.omg.sysml.logic;

import static org.junit.Assert.assertNull;

import org.junit.Test;
import org.omg.sysml.lang.sysml.AssignmentActionUsage;
import org.omg.sysml.lang.sysml.FeatureChaining;
import org.omg.sysml.lang.sysml.SysMLFactory;

/**
* Tests utility behavior reached from SysML derived properties.
*/
public class TypeUtilTest {

/**
* Derived properties on some feature-like SysML elements ask TypeUtil for
* owned parameters. When the feature is a chain whose target has not been
* linked yet, the basic feature is null and the derivation must simply see no
* parameters.
*/
@Test
public void derivedPropertyHandlesUnresolvedChainedFeatureWithoutParameters() {
SysMLLogicStandaloneSetup.doSetup();

AssignmentActionUsage assignment = SysMLFactory.eINSTANCE.createAssignmentActionUsage();
FeatureChaining unresolvedChaining = SysMLFactory.eINSTANCE.createFeatureChaining();
assignment.getOwnedRelationship().add(unresolvedChaining);

assertNull(assignment.getValueExpression());
}
}
Loading