CLASS zcl_system_clients_asql_td DEFINITION
PUBLIC
FINAL
CREATE PUBLIC.
PUBLIC SECTION.
METHODS constructor.
METHODS provide_test_double_records
RETURNING
VALUE(result) TYPE zcl_system_clients=>clients.
PROTECTED SECTION.
PRIVATE SECTION.
DATA test_double_records TYPE zcl_system_clients=>clients.
METHODS add_golden_record.
METHODS add_silver_record.
METHODS add_bronze_record.
ENDCLASS.
CLASS zcl_system_clients_asql_td IMPLEMENTATION.
METHOD constructor.
add_golden_record( ).
add_silver_record( ).
add_bronze_record( ).
ENDMETHOD.
METHOD provide_test_double_records.
result = test_double_records.
ENDMETHOD.
METHOD add_golden_record.
INSERT VALUE #( mandt = '000' mtext = 'golden record' ) INTO TABLE test_double_records.
ENDMETHOD.
METHOD add_silver_record.
INSERT VALUE #( mandt = '001' mtext = 'silver record' ) INTO TABLE test_double_records.
ENDMETHOD.
METHOD add_bronze_record.
INSERT VALUE #( mandt = '999' mtext = 'bronze record' ) INTO TABLE test_double_records.
ENDMETHOD.
ENDCLASS.
CLASS ltc_test DEFINITION FINAL
FOR TESTING
DURATION SHORT
RISK LEVEL HARMLESS.
PUBLIC SECTION.
METHODS get_client_000 FOR TESTING.
METHODS get_client_001 FOR TESTING.
METHODS get_client_999 FOR TESTING.
PRIVATE SECTION.
CLASS-DATA osql_test_environment TYPE REF TO if_osql_test_environment.
CLASS-DATA clients_test_data_provider TYPE REF TO zcl_system_clients_asql_td.
CLASS-METHODS class_setup.
CLASS-METHODS class_teardown.
ENDCLASS.
CLASS ltc_test IMPLEMENTATION.
METHOD class_setup.
osql_test_environment = cl_osql_test_environment=>create( VALUE #( ( 'T000' ) ) ).
clients_test_data_provider = NEW zcl_system_clients_asql_td( ).
DATA(clients_test_data) = clients_test_data_provider->provide_test_double_records( ).
osql_test_environment->insert_test_data( clients_test_data ).
ENDMETHOD.
METHOD class_teardown.
osql_test_environment->destroy( ).
ENDMETHOD.
METHOD get_client_000.
DATA(cut) = NEW zcl_system_clients( ).
DATA(result) = cut->get_client( '000' ).
cl_aunit_assert=>assert_not_initial( result ).
ENDMETHOD.
METHOD get_client_001.
DATA(cut) = NEW zcl_system_clients( ).
DATA(result) = cut->get_client( '001' ).
cl_aunit_assert=>assert_not_initial( result ).
ENDMETHOD.
METHOD get_client_999.
DATA(cut) = NEW zcl_system_clients( ).
DATA(result) = cut->get_client( '999' ).
cl_aunit_assert=>assert_not_initial( result ).
ENDMETHOD.
ENDCLASS.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
4 | |
3 | |
3 | |
2 | |
2 | |
2 | |
1 | |
1 | |
1 | |
1 |