Since I have several fields on the registration screen and I use the same string resource for empty fields, how can I get around this error?
com.som.android.acceptanceTests.signIn.RegistrationScreenTest > startRegistrationWithEmptyFields[emu_19_WXGA720(AVD) - 5.0.2] FAILED
android.support.test.espresso.AmbiguousViewMatcherException: '(with id: com.fentury.android:id/errorMessage and with text: is "This field cannot be empty")' matches multiple views in the hierarchy.
Problem views are marked with '****MATCHES****' below.
Here's a great resource for Espresso matchers: https://google.github.io/android-testing-support-library/docs/espresso/cheatsheet/
Looks like you need something along the lines of:
onView(allOf(withId(R.id.errorMessage), withSibling(withId(id for particular input))))
or isDescendantOfA() to if it has a unique container view
Related
I am trying to understand on how to perform queries in Redisearch strictly with "begins with" and I keep getting "contains".
For example if I have fields with values like 'football', 'myfootball', 'greenfootball' and would provide a search term like this:
> FT.SEARCH myIdx #myfield:foot*
I want just to get 'football' but I keep getting other fields that contain the word instead of beginning with that word.
Is there a way to avoid this?
I was trying to use VERBATIM and things like #myfield:^foot* but nothing.
I am using JRedisearch as a client but eventually I had to enter the DB and perform these queries manually in order to figure out what's happening. That being said, is this possible to do with this client at the moment?
Thanks
EDIT
A sample of my index setup:
Client client = new Client(INDEX_NAME, url, PORT);
Schema sc = new Schema().addSortableTextField("url", 1.0); // using this field for query
client.dropIndex(true);
client.createIndex(sc, Client.IndexOptions.Default());
return client;
Sample document:
id: // random uuid
urlPath: myfootbal
application: web
market: Europe
After checking the RDB provided I see that when searching foot* you are not getting myfootbal. The replies look like this: /dot-com/plp/football/x/index.html. You are getting those replies because this url is tokenized, and '/' is one of the tokenize chars. If you do not want those urls to be tokenized you need to declare them as TAGS and not as TEXT. This way the entire url will be indexed as is and when search for foot* it will not appear in the results.
For more information about TAGS see the FT.CREATE documentation: https://oss.redislabs.com/redisearch/Commands.html
I'm trying to get Thymeleaf to build me a URL where the domain part is a parameter, some fragment is a literal string, and the query parameters are also parameterized.
The documentation offers some examples:
#{${myDomain}/literalUrl}
#{${myDomain}'/literalUrl'}
#{/literalUrl(query=${queryValue})}
#{'/literalUrl'(query=${queryValue})}
#{${myDomain}(query=${queryValue})}
or even
<a th:with="baseUrl=${myDomain}" th:href="#{${baseUrl}}(query=${queryValue})}">
Separately, all of these work well. But if I try to combine them, the domain part suddenly refuses to resolve:
#{${myDomain}/literalUrl(query=${queryValue})} and #{${myDomain}+'/literalUrl'+(query=${queryValue})} each resolve to ${myDomain}/literalUrl?query=queryValue, and
How do I get Thymeleaf to properly generate my url https://example.com/literalUrl?query=queryValue
Don't know if this is a legit solution for your problem, but if you concat the literalUrl with the first parameter, it will work. Down side: you need an additional model parameter.
<a th:href="#{${linkData+path}(q=${queryParam})}">some link</a>
gets
some link
with model params:
mv.addObject("linkData", "https://example.com");
mv.addObject("path", "/literalUrl");
mv.addObject("queryParam", "queryValue");
I have a strange problem
this is what I have in routes files
GET /path/list controllers.path.getPaths()
GET /path/:id controllers.path.get(id:Int)
when I try to go <domain>/path/list the following error shows up:
For request 'GET /path/list' [Cannot parse parameter id as Int: For
input string: "list"]
I also tried to change the order in routes file
GET /path/:id controllers.path.get(id:Int)
GET /path/list controllers.path.getPaths()
I still get the same error. so my question is
isn't route supposed to match the first path that matches?
what else could be the problem (e.g. java codes)?
From the code you've provided this should work. The routes are not ambiguous because (from Play documentation):
Many routes can match the same request. If there is a conflict, the first route (in declaration order) is used.
if your routes ordering looks like this:
GET /path/list controllers.path.getPaths()
GET /path/:id controllers.path.get(id:Int)
/path/list will match before attempting to extract/transform the id parameter id:Int from the path and throwing.
If you want Play to transform the incoming parameter into a specific Scala type, you can add an explicit type
The only way this would not work is if you attempted to visit a route that did not match list or was not an Int:
For request 'GET /path/lists' [Cannot parse parameter id as Int: For input string: "lists"]
i have a problem when i run a page.jsp :
Exception while calling encodeEnd on component : {Component-Path : [Class: javax.faces.component.UIViewRoot,ViewId: /compteListe.jsp][Class: javax.faces.component.html.HtmlDataTable,Id: j_id_jsp_1879226420_1][Class: javax.faces.component.UIColumn,Id: j_id_jsp_1879226420_2][Class: javax.faces.component.html.HtmlOutputText,Id: j_id_jsp_1879226420_4]}
Caused by:
org.apache.jasper.el.JspPropertyNotFoundException - /compteListe.jsp(29,13) '#{l.Identifiant}' Property 'Identifiant' not found on type com.bankonet.bean.Compte
but when i do System.out.println (rs.getString (1));..., it works well and displays data !!
Unless the property name itself actually starts with 2 uppercased characters, the property name in EL needs to start with lowercase, so:
#{l.identifiant}
This requires a public no-arg getter method with name getIdentifiant().
org.apache.jasper.el.JspPropertyNotFoundException - /compteListe.jsp(29,13) '#{l.Identifiant}' Property 'Identifiant' not found on type com.bankonet.bean.Compte
It searches for a Field with name Identifiant in class com.bankonet.bean.Compte with standard setter/getter methods , which it doesn't find and so the error
but when i do System.out.println (rs.getString (1));..., it works well and displays data !!
It doesn't relate to your problem. You need to pass a collection to view to produce view
Here is what i want to be able to do with bean validation in my JPA entities :
Instead of #NotNull, i would like to do #NotNull(message="keyInMyResourceBundleFile")
I would like also to parameterize the resourceBundle, and i dont know the syntax for it, because it seems to me the message attribute contains only a string.
The parameter itself could be i18n-ed. For example, assuming there's a param attribute for the resourcebundle parameters, in English, #NotNull(message="missing.value", params={"credit card"}) String creditCard; It will be displayed something like this : "Missing required value for field credit card. In Indonesia, it'll be something like "Nilai harus di isi untuk Kartu Kredit. In this example, i cant hardcode the "credit card" because in Indonesia, it's "Kartu Kredit"
Displays the error message defined in the resource bundle on the log file or UI. Im not sure the way on how to do it, should i catch the ConstraintViolationException, get the message, and process the resource bundle by my own code ?
Please share your thoughts on this ?
Thank you !
Regarding 1 + 2
#NotNull(message="{keyInMyResourceBundleFile}")
Curly brackets are the indicator of a parameter substitution
Regarding 3
No idea what you are after. There is no params attribute for #NotNull. I guess you would do
#NotNull(message="{missing.credit.card}")
And of if you place it on another property you would call the key {missing.name}
Regarding 4
The ConstraintViolationException contains the set of *ConstraintViolation*s. Each ConstraintViolation contains the interpolated message as well as the message template. If you want to log it, do it ...