How can i mock a new final class

473 Views Asked by At

My code is as follows.

import org.xbill.DNS.Lookup;
import org.xbill.DNS.Record;
import org.xbill.DNS.Type;

public class MailCheckService {
    public Record[] mailHostValidate(String email, MailEntity mailEntity) {
        Record[] records = null;
        String hostName = email.split("@")[1];
        try {
            Lookup lookup = new Lookup(hostName, Type.MX);
            lookup.run();
            records = lookup.getAnswers();
        } catch (IOException e) {
            throw e;
        }
        return records;
    }
}

how can i mock the Lookup class or rewrite it.

if possible, please provide the version of jar.

Thanks and best regards.

0

There are 0 best solutions below