From 84c33798ea25d2c01e887a8a3ba654ada89ed3ad Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Sat, 25 Mar 2017 21:02:27 +0100 Subject: [PATCH] Fix tests --- OsmAnd-java/src/net/osmand/search/SearchUICore.java | 2 +- OsmAnd-java/src/net/osmand/search/core/SearchPhrase.java | 2 +- OsmAnd-java/test/java/net/osmand/search/LocationSearchTest.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/OsmAnd-java/src/net/osmand/search/SearchUICore.java b/OsmAnd-java/src/net/osmand/search/SearchUICore.java index 8ca902fdad..21c830dea6 100644 --- a/OsmAnd-java/src/net/osmand/search/SearchUICore.java +++ b/OsmAnd-java/src/net/osmand/search/SearchUICore.java @@ -505,7 +505,7 @@ public class SearchUICore { @Override public boolean publish(SearchResult object) { - if (!phrase.getNameStringMatcher().matches(object.localeName)) { + if (phrase != null && !phrase.getNameStringMatcher().matches(object.localeName)) { for (String s : object.otherNames) { if (phrase.getNameStringMatcher().matches(s)) { object.alternateName = s; diff --git a/OsmAnd-java/src/net/osmand/search/core/SearchPhrase.java b/OsmAnd-java/src/net/osmand/search/core/SearchPhrase.java index aa4b74c383..f8708bfdeb 100644 --- a/OsmAnd-java/src/net/osmand/search/core/SearchPhrase.java +++ b/OsmAnd-java/src/net/osmand/search/core/SearchPhrase.java @@ -289,7 +289,7 @@ public class SearchPhrase { } public ObjectType[] getSearchTypes() { - return settings.getSearchTypes(); + return settings == null ? null : settings.getSearchTypes(); } public boolean isCustomSearch() { diff --git a/OsmAnd-java/test/java/net/osmand/search/LocationSearchTest.java b/OsmAnd-java/test/java/net/osmand/search/LocationSearchTest.java index a5b07f1f08..73d608f4eb 100644 --- a/OsmAnd-java/test/java/net/osmand/search/LocationSearchTest.java +++ b/OsmAnd-java/test/java/net/osmand/search/LocationSearchTest.java @@ -15,7 +15,7 @@ import org.junit.Test; public class LocationSearchTest { private void search(String string, LatLon latLon) throws IOException { - SearchResultMatcher srm = new SearchUICore.SearchResultMatcher(null, 0, null, 100); + SearchResultMatcher srm = new SearchUICore.SearchResultMatcher(null, null, 0, null, 100); new SearchCoreFactory.SearchLocationAndUrlAPI(). search(new SearchPhrase(null, OsmAndCollator.primaryCollator()).generateNewPhrase(string, null), srm); Assert.assertEquals(1, srm.getRequestResults().size());