尝试查找Maven的InvoiceStorage依赖项

时间:2019-10-02 16:54:29

标签: java maven junit

我正在跟随一个具有外部类InvoiceStorage的教程,我对此很不高兴,但是java无法解析该InvoiceStorage符号,所以我认为我需要一个在教程中未显示的依赖项

教程链接: https://semaphoreci.com/community/tutorials/stubbing-and-mocking-with-mockito-2-and-junit


package com.mokitoTutorial.app;

import com.clusterra.email.sender.EmailSender;


public class LateInvoiceNotifier {
    private final EmailSender emailSender;
    private final InvoiceStorage invoiceStorage;

    public LateInvoiceNotifier(final EmailSender emailSender, final InvoiceStorage invoiceStorage){
        this.emailSender = emailSender;
        this.invoiceStorage = invoiceStorage;
    }

    public void notifyIfLate(Customer customer)
    {
        if(invoiceStorage.hasOutstandingInvoice(customer)){
            emailSender.sendEmail(customer);
        }
    }
}

1 个答案:

答案 0 :(得分:0)

在本文中,作者仅提供了有关如何使用模仿的示例。您可以从上述文章中看到以下内容。

  

在实际系统中,InvoiceStorage类实际上是一个Web服务。   与外部旧式CRM系统连接的速度很慢。一个单位   测试永远不能利用诸如Web服务之类的东西。

作者指的是一个称为InvoiceStorage的类,例如。没有依赖性。您可以阅读本文,也可以创建自己的课程进行测试。

相关问题