blob: 8e457517b268c294701bad7d39c70f98e2f279f7 [file] [log] [blame]
/*******************************************************************************
* Copyright (C) 2021 the Eclipse BaSyx Authors
*
* 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
******************************************************************************/
package org.eclipse.basyx.testsuite.regression.submodel.metamodel.connected.submodelelement.dataelement;
import static org.junit.Assert.assertEquals;
import org.eclipse.basyx.submodel.metamodel.api.identifier.IdentifierType;
import org.eclipse.basyx.submodel.metamodel.api.reference.enums.KeyElements;
import org.eclipse.basyx.submodel.metamodel.connected.submodelelement.dataelement.ConnectedMultiLanguageProperty;
import org.eclipse.basyx.submodel.metamodel.map.qualifier.LangStrings;
import org.eclipse.basyx.submodel.metamodel.map.reference.Key;
import org.eclipse.basyx.submodel.metamodel.map.reference.Reference;
import org.eclipse.basyx.submodel.metamodel.map.submodelelement.dataelement.MultiLanguageProperty;
import org.eclipse.basyx.submodel.restapi.SubmodelElementProvider;
import org.eclipse.basyx.testsuite.regression.vab.manager.VABConnectionManagerStub;
import org.eclipse.basyx.vab.modelprovider.lambda.VABLambdaProvider;
import org.eclipse.basyx.vab.support.TypeDestroyingProvider;
import org.junit.Before;
import org.junit.Test;
/**
* Tests if a ConnectedMultiLanguageProperty can be created and used correctly
*
* @author conradi
*
*/
public class TestConnectedMultiLanguageProperty {
ConnectedMultiLanguageProperty connectedMLP;
MultiLanguageProperty MLP;
@Before
public void build() {
Reference ref = new Reference(new Key(KeyElements.BLOB, true, "", IdentifierType.CUSTOM));
LangStrings langStrings = new LangStrings("de", "TestBeschreibung");
MLP = new MultiLanguageProperty(ref, langStrings);
VABConnectionManagerStub manager = new VABConnectionManagerStub(
new SubmodelElementProvider(new TypeDestroyingProvider(new VABLambdaProvider(MLP))));
// Retrieve the ConnectedContainerProperty
connectedMLP = new ConnectedMultiLanguageProperty(manager.connectToVABElement(""));
}
/**
* Tests if getValue() returns the correct value
*/
@Test
public void testGetValue() {
assertEquals(MLP.getValue().get("de"), connectedMLP.getValue().get("de"));
}
/**
* Tests if getValueId() returns the correct value
*/
@Test
public void testGetValueId() {
assertEquals(MLP.getValueId(), connectedMLP.getValueId());
}
}