22
33import * as assert from 'assert' ;
44import * as path from 'path' ;
5+ import * as sinon from 'sinon' ;
56import { CodeAction , CodeActionContext , CodeActionKind , CodeActionTriggerKind , DiagnosticSeverity , ExtensionContext , Position , Range , Uri , window } from "vscode" ;
67import { Commands } from '../../src/commands' ;
78import { GradleCodeActionProvider } from '../../src/gradle/gradleCodeActionProvider' ;
@@ -14,10 +15,10 @@ const gradleProjectFsPath: string = path.join(__dirname, '..', '..', '..', 'test
1415suite ( 'Code Action Provider Test' , ( ) => {
1516
1617 test ( 'Provide reload project action on demand for pom file' , async function ( ) {
17- const contextMock = {
18- subscriptions : [ ]
19- } ;
20- const provider = new PomCodeActionProvider ( contextMock as ExtensionContext ) ;
18+ const provider = sinon . createStubInstance ( PomCodeActionProvider ) ;
19+ provider . provideCodeActions . restore ( ) ;
20+ provider . getNewTextIndentation . restore ( ) ;
21+ provider . collectCodeActions . restore ( ) ;
2122
2223 const codeActionContext : CodeActionContext = {
2324 triggerKind : CodeActionTriggerKind . Invoke ,
@@ -36,10 +37,9 @@ suite('Code Action Provider Test', () => {
3637 } ) ;
3738
3839 test ( 'Provide reload project action on demand for gradle file' , async function ( ) {
39- const contextMock = {
40- subscriptions : [ ]
41- } ;
42- const provider = new GradleCodeActionProvider ( contextMock as ExtensionContext ) ;
40+ const provider = sinon . createStubInstance ( GradleCodeActionProvider ) ;
41+ provider . provideCodeActions . restore ( ) ;
42+ provider . provideGradleCodeActions . restore ( ) ;
4343
4444 const codeActionContext : CodeActionContext = {
4545 triggerKind : CodeActionTriggerKind . Invoke ,
0 commit comments