@ -40,6 +40,7 @@ import org.apache.dolphinscheduler.api.permission.ResourcePermissionCheckService
import org.junit.Assert ;
import org.junit.Before ;
import org.junit.Test ;
import org.junit.jupiter.api.Assertions ;
import org.junit.runner.RunWith ;
import org.mockito.InjectMocks ;
import org.mockito.Mock ;
@ -172,7 +173,8 @@ public class AlertPluginInstanceServiceTest {
Mockito . when ( resourcePermissionCheckService . operationPermissionCheck ( AuthorizationType . ALERT_PLUGIN_INSTANCE , null , 1 , ALART_INSTANCE_CREATE , baseServiceLogger ) ) . thenReturn ( true ) ;
Mockito . when ( resourcePermissionCheckService . resourcePermissionCheck ( AuthorizationType . ALERT_PLUGIN_INSTANCE , null , 0 , baseServiceLogger ) ) . thenReturn ( true ) ;
Map < String , Object > result = alertPluginInstanceService . create ( user , 1 , "test" , uiParams ) ;
Assert . assertEquals ( Status . PLUGIN_INSTANCE_ALREADY_EXIT , result . get ( Constants . STATUS ) ) ;
Assertions . assertEquals ( Status . PLUGIN_INSTANCE_ALREADY_EXISTS , result . get ( Constants . STATUS ) ) ;
Mockito . when ( alertPluginInstanceMapper . insert ( Mockito . any ( ) ) ) . thenReturn ( 1 ) ;
result = alertPluginInstanceService . create ( user , 1 , "test1" , uiParams ) ;
Assert . assertEquals ( Status . SUCCESS , result . get ( Constants . STATUS ) ) ;