com-pas/compas-sct

Empty message in ScdException in AbstractDataAttributeAdapter.check

Opened this issue · 0 comments

Subject of the issue

Method org.lfenergy.compas.sct.commons.scl.dtt.AbstractDataAttributeAdapter.check() throws a ScdException with empty message in case EnumType does not exist.

  • Version of CoMPAS : 0.2.16

Steps to reproduce

    @Test
    void myTest(){
        // Given
        TDataTypeTemplates tDataTypeTemplates = new TDataTypeTemplates();
        TDOType tdoType = new TDOType();
        TDA tda = new TDA();
        tda.setBType(TPredefinedBasicTypeEnum.ENUM);
        tda.setType("MyEnum");
        tdoType.getSDOOrDA().add(tda);
        tDataTypeTemplates.getDOType().add(tdoType);
        DAAdapter daAdapter = new DAAdapter(new DOTypeAdapter(new DataTypeTemplateAdapter(null, tDataTypeTemplates), tdoType), tda);

        // When & Then
        assertThatThrownBy(() -> daAdapter.check(new DaTypeName("toto")))
                .hasMessageMatching(".+");
    }

Expected behaviour

The test should succeed : the message of the exception should not be empty

Actual behaviour

The test fails : the message is an empty String