Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

completeFromDAInstance add Val instead of replacing it #470

Closed
massifben opened this issue Feb 5, 2025 · 0 comments · Fixed by #471
Closed

completeFromDAInstance add Val instead of replacing it #470

massifben opened this issue Feb 5, 2025 · 0 comments · Fixed by #471
Labels
bug Something isn't working

Comments

@massifben
Copy link
Contributor

massifben commented Feb 5, 2025

Subject of the issue

LnService.completeFromDAInstance add Val instead of replacing it.

  • Version of CoMPAS 0.2.35

Steps to reproduce
Create this test in LnServiceTest

@Test
void completeFromDAInstance_should_replace_existing_val() {
    //Given
    TIED tied = new TIED();
    TAnyLN tAnyLN = initDOAndDAInstances(
            new LinkedList<>(List.of("Do")),
            new LinkedList<>(List.of("Da")),
            "value from DAI", true
    );
    DataObject dataObject = new DataObject();
    dataObject.setDoName("Do");
    DataAttribute dataAttribute = new DataAttribute();
    dataAttribute.setDaName("Da");
    dataAttribute.getDaiValues().add(new DaVal(null, "value from DataTypeTemplate"));
    DoLinkedToDa doLinkedToDa = new DoLinkedToDa(dataObject, dataAttribute);
    //When
    LnService lnService = new LnService();
    lnService.completeFromDAInstance(tied, "ldInst", tAnyLN, doLinkedToDa);
    //Then
    assertThat(doLinkedToDa.dataAttribute().getDaiValues()).containsExactly(new DaVal(null, "value from DAI"));
}

Expected behaviour
Test should succeed : doLinkedToDa.dataAttribute should contain a single value "value from DAI".

Actual behaviour
doLinkedToDa.dataAttribute contains two values : "value from DAI", "value from DataTypeTemplate"

Test fails with error :

Expecting actual:
  [DaVal[settingGroup=null, val=value from DataTypeTemplate],
    DaVal[settingGroup=null, val=value from DAI]]
to contain exactly (and in same order):
  [DaVal[settingGroup=null, val=value from DAI]]
but some elements were not expected:
  [DaVal[settingGroup=null, val=value from DataTypeTemplate]]
@massifben massifben added the bug Something isn't working label Feb 5, 2025
massifben added a commit that referenced this issue Feb 5, 2025
…l by DAI Val

Signed-off-by: massifben <105049157+massifben@users.noreply.github.com>
massifben added a commit that referenced this issue Feb 6, 2025
…l by DAI Val

Signed-off-by: massifben <105049157+massifben@users.noreply.github.com>
massifben added a commit that referenced this issue Feb 7, 2025
…dd-val-instead-of-replacing-it

fix(#470) : completeFromDAInstance should replace dataTypeTemplate Val by DAI Val
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant