How to set address field programatically in Drupal 8

Address field consists of various sub values which can be configured accordingly. To set an address field programmatically use the following snippet.

        $address = [
          'country_code' => 'IN',
          'address_line1' => 'Test Address Line 1',
          'address_line2' => 'Test Address Line 2',
          'locality' => 'City',
          'administrative_area' => 'New Delhi',
          'postal_code' => '110001',
        ]; 

$entity-set('field_address', $address);

$entity->save();