public String resolve(String ensName) {
        if (Strings.isBlank(ensName) || (ensName.trim().length() == 1 && ensName.contains("."))) {
            return null;
        }

        try {
            if (isValidEnsName(ensName, addressLength)) {
                OffchainResolverContract resolver = obtainOffchainResolver(ensName);

                boolean supportWildcard =
                        resolver.supportsInterface(EnsUtils.ENSIP_10_INTERFACE_ID).send();
                byte[] nameHash = NameHash.nameHashAsBytes(ensName);

                String resolvedName;
                if (supportWildcard) {
                    String dnsEncoded = NameHash.dnsEncode(ensName);
                    String addrFunction = resolver.addr(nameHash).encodeFunctionCall();

                    String lookupDataHex =
                            resolver.resolve(
                                            Numeric.hexStringToByteArray(dnsEncoded),
                                            Numeric.hexStringToByteArray(addrFunction))
                                    .send();

                    resolvedName = resolveOffchain(lookupDataHex, resolver, LOOKUP_LIMIT);
                } else {
                    try {
                        resolvedName = resolver.addr(nameHash).send();
                    } catch (Exception e) {
                        throw new RuntimeException("Unable to execute Ethereum request: ", e);
                    }
                }

                if (!WalletUtils.isValidAddress(resolvedName)) {
                    throw new EnsResolutionException(
                            "Unable to resolve address for name: " + ensName);
                } else {
                    return resolvedName;
                }

            } else {
                return ensName;
            }
        } catch (Exception e) {
            throw new EnsResolutionException(e);
        }
    }
@Test
    public void testResolveWildCardSuccess() throws Exception {
        String resolvedAddress = "0x41563129cdbbd0c5d3e1c86cf9563926b243834d";

        EnsResolverForTest ensResolverForTest = new EnsResolverForTest(web3j);

        OffchainResolverContract resolverMock = mock(OffchainResolverContract.class);
        ensResolverForTest.setResolverMock(resolverMock);

        RemoteFunctionCall suppIntResp = mock(RemoteFunctionCall.class);
        when(resolverMock.supportsInterface(any())).thenReturn(suppIntResp);
        when(suppIntResp.send()).thenReturn(true);

        RemoteFunctionCall addrResp = mock(RemoteFunctionCall.class);
        when(resolverMock.addr(any())).thenReturn(addrResp);
        when(addrResp.encodeFunctionCall()).thenReturn("0x12345");

        RemoteFunctionCall resolveResp = mock(RemoteFunctionCall.class);
        when(resolverMock.resolve(any(), any())).thenReturn(resolveResp);
        when(resolveResp.send()).thenReturn(resolvedAddress);

        String result = ensResolverForTest.resolve("1.offchainexample.eth");

        assertNotNull(result);
        assertEquals(resolvedAddress, result);
    }