blob: e9fe5a7d29dfa134bf6d9ec4b99ffa525c2ec36e [file] [log] [blame]
// Copyright 2018 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// ignore_for_file: implementation_imports
import 'package:fidl/fidl.dart';
import 'package:fuchsia_modular/src/service_connection/agent_service_connection.dart';
import 'package:test/test.dart';
void main() {
group('connectToAgentService:=', () {
test('throws for null or empty agent url', () {
FakeAsyncProxy fakeServiceProxy =
FakeAsyncProxy('fuchsia.modular.FakeService', r'FakeService');
expect(() => connectToAgentService('', fakeServiceProxy), throwsException,
reason: 'AgentUrl cannot be empty');
expect(
() => connectToAgentService(null, fakeServiceProxy), throwsException,
reason: 'AgentUrl cannot be null');
});
test('throws if serviceProxy is null', () {
expect(() => connectToAgentService('agentUrl', null), throwsException);
});
});
}
class FakeAsyncProxy<T> extends AsyncProxy<T> {
String serviceName;
String interfaceName;
FakeAsyncProxy(this.serviceName, this.interfaceName)
: super(AsyncProxyController(
$serviceName: serviceName,
$interfaceName: interfaceName,
));
}