main function Null safety

void main()

Implementation

void main() async {
  // ====== Test static methods ======

  var defaultData = json.decode(
      '{[{"deviceId": "1234567890",            "deviceType": "shutter-control",            "ipAddress": "192.168.2.2",            "isDefaultPasswordSet" : "false",            "knownPassword": "1234567890123456",            "currentPasswordNumber": "1"        },        {            "deviceId": "1234567891",            "deviceType": "shutter-control",            "ipAddress": "192.168.2.2",            "isDefaultPasswordSet" : "false",            "knownPassword": "1234567890123456",            "currentPasswordNumber": "1"        }    ]}'
          .replaceAll(new RegExp(r' '), ''));
  var resultData = json.decode(
      '[{"deviceType":"shutter-control","deviceId":"1234567890","isDefaultPasswordSet":"false","knownPassword":"1234567890123456","currentPasswordNumber":"1"},{"deviceType":"shutter-control","deviceId":"1234567891","isDefaultPasswordSet":"false","knownPassword":"1234567890123456","currentPasswordNumber":"1"},{"deviceType":"shutter-control","deviceId":"0987654321","isDefaultPasswordSet":"false","knownPassword":"1234567890123","currentPasswordNumber":"3"}]');
  String testDataPath = '.\\lib\\util\\test\\devices.json';
  //Test Octets to Integer conversion
  print('Default value:');
  print(defaultData);

  test('Add device to File', () async {
    JsonStorage.storeDevice(
        ScpDevice(
          knownPassword: '1234567890123',
          currentPasswordNumber: 3,
          deviceId: '0987654321',
          deviceType: 'shutter-control',
          ipAddress: '192.168.42.42',
          isDefaultPasswordSet: false,
        ),
        testDataPath);

    var jsonData = await JsonStorage.readJson(testDataPath);
    expect(jsonData, equals(resultData));
  });
}