diff --git a/aio/content/examples/http/src/app/heroes/heroes.service.spec.ts b/aio/content/examples/http/src/app/heroes/heroes.service.spec.ts index bfc204b4ad..c3bf9bc7e0 100644 --- a/aio/content/examples/http/src/app/heroes/heroes.service.spec.ts +++ b/aio/content/examples/http/src/app/heroes/heroes.service.spec.ts @@ -28,9 +28,9 @@ describe('HeroesService', () => { // Inject the http, test controller, and service-under-test // as they will be referenced by each test. - httpClient = TestBed.get(HttpClient); - httpTestingController = TestBed.get(HttpTestingController); - heroService = TestBed.get(HeroesService); + httpClient = TestBed.inject(HttpClient); + httpTestingController = TestBed.inject(HttpTestingController); + heroService = TestBed.inject(HeroesService); }); afterEach(() => { @@ -44,7 +44,7 @@ describe('HeroesService', () => { let expectedHeroes: Hero[]; beforeEach(() => { - heroService = TestBed.get(HeroesService); + heroService = TestBed.inject(HeroesService); expectedHeroes = [ { id: 1, name: 'A' }, { id: 2, name: 'B' }, diff --git a/aio/content/examples/http/src/testing/http-client.spec.ts b/aio/content/examples/http/src/testing/http-client.spec.ts index f13c15a18b..853bacf5be 100644 --- a/aio/content/examples/http/src/testing/http-client.spec.ts +++ b/aio/content/examples/http/src/testing/http-client.spec.ts @@ -27,8 +27,8 @@ describe('HttpClient testing', () => { }); // Inject the http service and test controller for each test - httpClient = TestBed.get(HttpClient); - httpTestingController = TestBed.get(HttpTestingController); + httpClient = TestBed.inject(HttpClient); + httpTestingController = TestBed.inject(HttpTestingController); }); // #enddocregion setup // #docregion afterEach