Demo entry 4452688

mocking Spring


Submitted by anonymous on Apr 13, 2016 at 16:24
Language: Java. Code size: 363 Bytes.

package com.springinaction.knights;

import static org.mockito.Mockito.*;
import org.junit.Test;

public class BraveKnightTest {
  public void knightShouldEmbarkOnQuest() {
    Quest mockQuest = mock(Quest.class);
    BraveKnight knight = new BraveKnight(mockQuest);
    verify(mockQuest, times(1)).embark();

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).