use of com.opensimulationplatform.core.model.modeldescription.Unit in project osp-validator by open-simulation-platform.
the class AngularDisplacementValidatorTest method valid.
@Test
public void valid() {
ModelDescription modelDescription = new ModelDescription();
AngularDisplacement angularDisplacement = new AngularDisplacement();
Variable v1 = new Variable();
v1.setCausality(Variable.Causality.INPUT);
v1.setType(Variable.Type.REAL);
v1.setUnit(new Unit());
Variable v2 = new Variable();
v2.setCausality(v1.getCausality());
v2.setType(v1.getType());
v2.setUnit(v1.getUnit());
angularDisplacement.setVariables(Arrays.asList(v1, v2));
modelDescription.getAngularDisplacements().add(angularDisplacement);
AngularDisplacementValidator v = new AngularDisplacementValidator();
List<ValidationDiagnostic<AngularDisplacement>> diagnostics = v.validate(modelDescription);
assertTrue(diagnostics.isEmpty());
}
use of com.opensimulationplatform.core.model.modeldescription.Unit in project osp-validator by open-simulation-platform.
the class VE_AngularDisplacement_2_Test method invalid.
@Test
public void invalid() {
AngularDisplacement angularDisplacement = new AngularDisplacement();
Variable v1 = new Variable();
v1.setCausality(Variable.Causality.INPUT);
v1.setType(Variable.Type.REAL);
v1.setUnit(new Unit());
Variable v2 = new Variable();
v2.setCausality(v1.getCausality());
v2.setType(Variable.Type.INTEGER);
v2.setUnit(v1.getUnit());
angularDisplacement.setVariables(Arrays.asList(v1, v2));
builder.build(angularDisplacement);
builder.complete();
List<ValidationDiagnostic<AngularDisplacement>> diagnostics = validationError.validate();
assertEquals(1, diagnostics.size());
AngularDisplacement invalidObject = diagnostics.get(0).getValidatedObject();
List<Variable> variables = invalidObject.getVariables();
assertTrue(variables.contains(v1));
assertTrue(variables.contains(v2));
}
use of com.opensimulationplatform.core.model.modeldescription.Unit in project osp-validator by open-simulation-platform.
the class VE_AngularDisplacement_2_Test method valid.
@Test
public void valid() {
AngularDisplacement angularDisplacement = new AngularDisplacement();
Variable v1 = new Variable();
v1.setCausality(Variable.Causality.INPUT);
v1.setType(Variable.Type.REAL);
v1.setUnit(new Unit());
Variable v2 = new Variable();
v2.setCausality(v1.getCausality());
v2.setType(v1.getType());
v2.setUnit(v1.getUnit());
angularDisplacement.setVariables(Arrays.asList(v1, v2));
builder.build(angularDisplacement);
builder.complete();
List<ValidationDiagnostic<AngularDisplacement>> diagnostics = validationError.validate();
assertTrue(diagnostics.isEmpty());
}
use of com.opensimulationplatform.core.model.modeldescription.Unit in project osp-validator by open-simulation-platform.
the class VE_Charge_2_Test method valid.
@Test
public void valid() {
Charge charge = new Charge();
Variable v1 = new Variable();
v1.setCausality(Variable.Causality.INPUT);
v1.setType(Variable.Type.REAL);
v1.setUnit(new Unit());
Variable v2 = new Variable();
v2.setCausality(v1.getCausality());
v2.setType(v1.getType());
v2.setUnit(v1.getUnit());
charge.setVariables(Arrays.asList(v1, v2));
builder.build(charge);
builder.complete();
List<ValidationDiagnostic<Charge>> diagnostics = validationError.validate();
assertTrue(diagnostics.isEmpty());
}
use of com.opensimulationplatform.core.model.modeldescription.Unit in project osp-validator by open-simulation-platform.
the class VE_Charge_3_Test method valid.
@Test
public void valid() {
Charge charge = new Charge();
Variable v1 = new Variable();
v1.setCausality(Variable.Causality.INPUT);
v1.setType(Variable.Type.REAL);
v1.setUnit(new Unit());
Variable v2 = new Variable();
v2.setCausality(v1.getCausality());
v2.setType(v1.getType());
v2.setUnit(v1.getUnit());
charge.setVariables(Arrays.asList(v1, v2));
builder.build(charge);
builder.complete();
List<ValidationDiagnostic<Charge>> diagnostics = validationError.validate();
assertTrue(diagnostics.isEmpty());
}
Aggregations