### Question:
NamespaceRepositoryOkHttpImpl extends AbstractRepositoryOkHttpImpl implements NamespaceRepository { @Override public Observable<Page<NamespaceInfo>> search(NamespaceSearchCriteria criteria) { String ownerAddress = toDto(criteria.getOwnerAddress()); NamespaceRegistrationTypeEnum registrationType = criteria.getRegistrationType() == null ? null : NamespaceRegistrationTypeEnum.fromValue(criteria.getRegistrationType().getValue()); String level0 = criteria.getLevel0(); AliasTypeEnum aliasType = criteria.getAliasType() == null ? null : AliasTypeEnum.fromValue(criteria.getAliasType().getValue()); Integer pageSize = criteria.getPageSize(); Integer pageNumber = criteria.getPageNumber(); String offset = criteria.getOffset(); Order order = toDto(criteria.getOrder()); Callable<NamespacePage> callback = () -> getClient() .searchNamespaces( ownerAddress, registrationType, level0, aliasType, pageSize, pageNumber, offset, order); return exceptionHandling( call(callback) .map( page -> this.toPage( page.getPagination(), page.getData().stream() .map(this::toNamespaceInfo) .collect(Collectors.toList())))); } NamespaceRepositoryOkHttpImpl(ApiClient apiClient); NamespaceRoutesApi getClient(); @Override Observable<NamespaceInfo> getNamespace(NamespaceId namespaceId); @Override Observable<Page<NamespaceInfo>> search(NamespaceSearchCriteria criteria); @Override Observable<List<NamespaceName>> getNamespaceNames(List<NamespaceId> namespaceIds); @Override Observable<MosaicId> getLinkedMosaicId(NamespaceId namespaceId); @Override Observable<Address> getLinkedAddress(NamespaceId namespaceId); @Override Observable<List<AccountNames>> getAccountsNames(List<Address> addresses); @Override Observable<List<MosaicNames>> getMosaicsNames(List<MosaicId> ids);  }### Answer:
@Test public void search() throws Exception { Address address = Address.generateRandom(networkType); Address ownerAccount = Account.generateNewAccount(NetworkType.MIJIN_TEST).getAddress(); NamespaceInfoDTO dto = new NamespaceInfoDTO(); NamespaceMetaDTO meta = new NamespaceMetaDTO(); meta.setActive(true); meta.setId("SomeId"); meta.setIndex(123); dto.setMeta(meta); NamespaceDTO namespace = new NamespaceDTO(); namespace.setDepth(111); namespace.setStartHeight(BigInteger.valueOf(4)); namespace.setEndHeight(BigInteger.valueOf(5)); namespace.setRegistrationType(NamespaceRegistrationTypeEnum.NUMBER_1); namespace.setOwnerAddress(ownerAccount.encoded()); AliasDTO alias = new AliasDTO(); alias.setType(AliasTypeEnum.NUMBER_2); alias.setAddress(address.encoded()); namespace.setAlias(alias); dto.setNamespace(namespace); mockRemoteCall(toPage(dto)); NamespaceInfo info = repository .search(new NamespaceSearchCriteria().ownerAddress(address)) .toFuture() .get() .getData() .get(0); Assertions.assertNotNull(info); Assertions.assertEquals(NamespaceRegistrationType.SUB_NAMESPACE, info.getRegistrationType()); Assertions.assertEquals(meta.getId(), info.getMetaId()); Assertions.assertEquals(meta.getIndex(), info.getIndex()); Assertions.assertEquals(meta.getActive(), info.isActive()); Assertions.assertEquals(BigInteger.valueOf(4), info.getStartHeight()); Assertions.assertEquals(BigInteger.valueOf(5), info.getEndHeight()); }