All files / src/apack zcl_abapgit_apack_writer.clas.testclasses.abap

100% Statements 39/39
100% Branches 1/1
100% Functions 1/1
100% Lines 39/39

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 401x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x  
*"* use this source file for your ABAP unit test classes
CLASS ltcl_apack_manifest_writer DEFINITION FOR TESTING RISK LEVEL HARMLESS DURATION SHORT.
  PRIVATE SECTION.
    METHODS: the_serializator FOR TESTING RAISING cx_static_check.
ENDCLASS.
 
CLASS ltcl_apack_manifest_writer IMPLEMENTATION.
 
  METHOD the_serializator.
 
    DATA: ls_apack_manifest_descriptor TYPE zif_abapgit_apack_definitions=>ty_descriptor,
          lo_manifest_writer           TYPE REF TO zcl_abapgit_apack_writer,
          lv_bool                      TYPE abap_bool,
          lv_actual_xml                TYPE string.
 
    ls_apack_manifest_descriptor-group_id = 'github.com/larshp'.
    ls_apack_manifest_descriptor-artifact_id = 'abapGit'.
    ls_apack_manifest_descriptor-version = '1.8'.
    ls_apack_manifest_descriptor-git_url = 'https://github.com/larshp/abapGit.git'.
 
    lo_manifest_writer = zcl_abapgit_apack_writer=>create_instance( ls_apack_manifest_descriptor ).
    lv_actual_xml = lo_manifest_writer->serialize( ).
    cl_abap_unit_assert=>assert_not_initial( lv_actual_xml ).
 
    lv_bool = boolc( contains( val = lv_actual_xml
                               sub = '<ARTIFACT_ID>abapGit</ARTIFACT_ID>' ) ).
    cl_abap_unit_assert=>assert_equals( act = lv_bool
                                        exp = abap_true ).
    lv_bool = boolc( contains( val = lv_actual_xml
                               sub = '<GROUP_ID>github.com/larshp</GROUP_ID>' ) ).
    cl_abap_unit_assert=>assert_equals( act = lv_bool
                                        exp = abap_true ).
    lv_bool = boolc( contains( val = lv_actual_xml
                               sub = '<REPOSITORY_TYPE>abapGit</REPOSITORY_TYPE>' ) ).
    cl_abap_unit_assert=>assert_equals( act = lv_bool
                                        exp = abap_true ).
  ENDMETHOD.
 
ENDCLASS.