/*
 * Copyright 2016-2018 shardingsphere.io.
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * </p>
 */

package io.shardingsphere.orchestration.internal.state.service;

import io.shardingsphere.orchestration.internal.RegistryCenterLoader;
import io.shardingsphere.orchestration.reg.api.RegistryCenter;
import io.shardingsphere.orchestration.reg.api.RegistryCenterConfiguration;
import org.junit.Before;
import org.junit.Test;

import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.verify;

public class InstanceStateServiceTest {
    
    private RegistryCenter regCenter;
    
    private InstanceStateService instanceStateService;
    
    @Before
    public void setUp() {
        regCenter = RegistryCenterLoader.load(new RegistryCenterConfiguration());
        instanceStateService = new InstanceStateService("test", regCenter);
    }
    
    @Test
    public void testPersistInstanceOnline() {
        instanceStateService.persistInstanceOnline();
        verify(regCenter).persistEphemeral(anyString(), "");
    }
}

@@ -717,24 +717,23 @@
 tration.
-internal
+reg.api
 .Registr
@@ -739,22 +739,16 @@
 ryCenter
-Loader
 ;%0Aimport
@@ -752,138 +752,80 @@
 ort 
-io.shardingsphere.orchestration.reg.api.RegistryCenter;%0Aimport io.shardingsphere.orchestration.reg.api.RegistryCenterConfiguration
+org.junit.Before;%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith
 ;%0Aim
@@ -829,36 +829,36 @@
 %0Aimport org.
-junit.Before
+mockito.Mock
 ;%0Aimport org
@@ -858,26 +858,48 @@
 ort org.
-junit.Test
+mockito.junit.MockitoJUnitRunner
 ;%0A%0Aimpor
@@ -990,16 +990,51 @@
 erify;%0A%0A
+@RunWith(MockitoJUnitRunner.class)%0A
 public c
@@ -1066,24 +1066,34 @@
 Test %7B%0A    %0A
+    @Mock%0A
     private 
@@ -1225,90 +1225,8 @@
 ) %7B%0A
-        regCenter = RegistryCenterLoader.load(new RegistryCenterConfiguration());%0A
     
@@ -1478,10 +1478,19 @@
 (), 
-%22%22
+anyString()
 );%0A 

use anyString()