Posts by laaf • 411 points
24 posts
-
1
votes0
answers18
viewsQ: Using a Selenium Browser session in another navigation
I have a project in Selenium that logs in to a site and returns in an endpoint the cookies generated in that login. Another project consumes these cookies and injects it into your own browser to…
-
1
votes0
answers33
viewsQ: Htmlunit - Htmlpage with special characters and different formatting
Use Htmlunit and when I give a Webclient.getPage() to a url, I get one Htmlpage thus (htmlPage.asXml()): <?xml version="1.0" encoding="ISO-8859-1"?> <html> <head> <script…
-
1
votes2
answers651
viewsA: Normalize or other way to format String
I had not attempted that these numbers do not correspond to any letter, so probably there is no java function to format this. What I did, it was a real gambit: private static final Pattern…
-
-1
votes2
answers651
viewsQ: Normalize or other way to format String
I have this method: public static String trataNomeArquivo(String nomeArquivo) { return Normalizer.normalize(nomeArquivo, Normalizer.Form.NFD).replaceAll("[^\\p{ASCII}]", "").toUpperCase(); } She…
-
1
votes0
answers26
viewsQ: Objects not being serialized - For XML - Java
I need to make a requisition SOAP with the completed Group : <EncerraAgendamentoAuditoria xmlns="http://tempuri.org/"> <lstrIDProcessoUnico>string</lstrIDProcessoUnico>…
-
1
votes1
answer337
viewsQ: Convert String to Offsetdatetime (dd 'from' MMMM 'from' yyyy 'to' HH:mm:ss)
I got this String : 17 October 2008 at 11:35:04 And that Pattern: dd 'de' MMMM 'de' yyyy 'às' HH:mm:ss And that code: private OffsetDateTime getData(){ return…
-
0
votes0
answers584
viewsQ: java.lang.Outofmemoryerror: Java heap space (even with memory boost)
My code has this bug. But I’ve tried: Increase memory in VM settings: # custom Intellij IDEA VM options -Xms512m -Xmx1024m -XX:Reservedcodecachesize=480m -XX:+Useconcmarksweepgc…
-
1
votes1
answer61
viewsQ: Transforming "26/Feb/2013" into an Offsetdatetime (2013-02-26 00:00:00)
I gave an example of the month of February, but it could be Jan, Mar, etc... I get a String with the "abbreviated" month (only the date as in the title), I want to convert this to a Offsetdatetime…
-
2
votes1
answer75
viewsQ: Distinct and group in Mongodb
I have this query: db.getCollection('lojasDisponiveis').aggregate( [ { $group: { _id: { codigosLojas: "$codigosLojas", codigoUrl: "$codigoUrl" }}} ] ); The problem: For each store or group of…
-
2
votes1
answer1812
viewsQ: Uses of @Bean and @Autowired notations and what are they for?
I have difficulty understanding these two notations and what they are for. I read documentation and some answers about, and from what I understood @Bean would be an instance creation of a class, and…
-
0
votes1
answer80
viewsQ: Cast from object type name(String)
I get a list that has several types of Htmlelements. I need a Namevaluepair list, with name and value of each object. So I have this function that gets the list: private List getValoresPost(List…
-
0
votes1
answer33
viewsA: atOffset using map
The way I found it was this, it worked: private OffsetDateTime getDataDistribuicao() { return Optional.ofNullable(this.getPaginaInfoGerais()) .map(page ->…
-
2
votes1
answer33
viewsQ: atOffset using map
private OffsetDateTime getDataDistribuicao() { return Optional.ofNullable(this.getPaginaInfoGerais()) .map(page -> page.<HtmlTableCell>getFirstByXPath(XPATH_CEL_DATA_DISTRIBUICAO))…
-
0
votes1
answer2918
viewsQ: How do I use Optional.ofNullable() in this example?
In this example, how can I use this feature to avoid NullPointerException us get? public Pessoa parse() { Pessoa pessoa = new Pessoa(); RespostaPessoaEncontrada pessoaEncontrada =…
-
1
votes1
answer181
viewsQ: Mockito - Function that receives jsonObject return false
public class ParseProcessoTest { private final String PATTERN_DATA_HORA = "yyyy-MM-dd HH:mm:ss"; JSONObject jsonObject = new JSONObject("json qualquer"); JSONObject jsonMov = new JSONObject("json…
-
1
votes1
answer476
viewsQ: Mock of a class that has parameters in the constructor
public class ParseProcessoTest { private final String PATTERN_DATA_HORA = "yyyy-MM-dd HH:mm:ss"; JSONObject jsonObject; @Mock ParseProcesso parseProcesso; @Before public void init(){ jsonObject =…
-
1
votes1
answer3489
viewsQ: Error "could not be Parsed" when converting string to Datetime type
I get a Date String like this: 2017-10-11 10:39:04.217923 I take that number off after the point, and I use the LocalDateTime.parse(): private final String PATTERN_DATA_HORA = "dd/MM/yyyy HH:mm:ss";…
-
2
votes2
answers593
viewsA: AND operator in regex
Well, from what I researched, this problem is that the | (OR) operator in Java considers only one group. So what I did was go around it like I saw on some forums: private String…
-
6
votes2
answers593
viewsQ: AND operator in regex
I have the following date/time format: 25/01/2017às11:53:37 And the following regex: REGX_DATAHORA_DISTRIBUICAO = "(?<data>\d{1,2}\/\d{1,2}\/\d{4})|(?<hora>\d{1,2}:\d{1,2}:\d{1,2})"…
-
1
votes0
answers124
viewsQ: Java - When(). Thenreturn() Mockite Function
@Mock RequestUtils requestUtils; @Before public void init() throws IOException, ClassNotFoundException { MockitoAnnotations.initMocks(this); HtmlPage paginaPesquisa =…
-
2
votes2
answers96
viewsQ: Save a page from an Htmlpage (java)
I have a method that generates an Htmlpage, I would like to save to disk. public void gerarPaginaIndex() { try { final HtmlPage paginaIndex = WebClientFactory.getInstance().getPage(URL_INICIAL);…
-
1
votes2
answers590
viewsQ: Separating Sentences in a String
I have this String with a space between the title (uppercase) and the description: THE CASE BACK TO DISTRIBUTOR Drop again The code: final String linha =…
-
0
votes1
answer202
viewsQ: Use of hashmap to make comparisons
I have the following situation: I get a list of itensVenda, and in it I have associated with Venda. In the Venda I have a list of itensVenda and the Cliente, and in Customer, I have associated a…
-
1
votes1
answer287
viewsQ: Item in selected combobox, display data in jTable
Before asking this question, I searched the forum and in several places but could not solve... I have a combobox that already carries the names of customers, then I wanted to select the customer,…