我試圖測試處理轉換和持久性的服務實現。 我有一個存儲庫嘲笑和轉換服務連線 是否有可能在Spock有一個模擬回傳給它的對象返回? 我想寫的語法如下。 即 // Have this method return the object that has been passed to it.
repository.save(_ as Entity) >> (Entity) _
我試着爲spock中的CompletableFuture創建存根或模擬。我的方法被稱爲異步並返回CompletableFuture。在spock方法中總是返回null。怎麼了? public class ProductFactory() {
@Autowired
ProductRepository repository;
public Product create