1. code

package com.springinaction.knights;
import static org.mockito.Mockito.*;

import org.junit.Test;
public class KnightQuestTest {

    @Test
    public void knightcallQuest(){
        Quest mockQuest = mock(Quest.class);
        KnightImpl k = new KnightImpl(mockQuest);
        k.embarkOnQuest();
        verify(mockQuest, times(1)).embark();
    }

}

 

相关文章:

  • 2021-08-11
  • 2022-12-23
  • 2021-11-14
  • 2021-05-11
  • 2021-07-18
  • 2021-05-30
  • 2021-08-23
  • 2022-02-01
猜你喜欢
  • 2022-12-23
  • 2021-09-20
  • 2021-10-13
  • 2022-02-20
  • 2022-03-01
  • 2021-10-08
  • 2021-09-29
相关资源
相似解决方案