Skip to content

Is Spring Framework used in a unit test?

I am getting ready to take my Spring Certification v5.0 and there appears to be a question: Do you use Spring in a unit test? Link to Exam Guide questions. From Spring reference guide I know this: The POJOs that make up your application should be testable in JUnit or TestNG tests, with objects simply instanti…

Incompatible library version selenium / guava

My app has a hard dependency on com.google.guava:guava:23.3 or superior But I am also using org.seleniumhq.selenium:selenium-java:3.0.1 which is incompatible with guava versions > 22.0 as discussed here: https://github.com/SeleniumHQ/selenium/issues/4381 I am pretty new to Java, what is the best course of …

How do I replace multiple characters in a String?

How do I replace multiple characters in a String? Like Java’s replaceAll(regex:replacement:) function. This answer is very close but I want to change more than one character at the same time. Answer [$,.] is regex, which is the expected input for Java’s replaceAll() method. Kotlin, however, has a …

Can Java’s Stream.collect() return null?

The JavaDoc for Stream.collect() says that it returns “the result of the reduction”. That doesn’t tell me if code like this can return null for filteredList: I would expect that if it could return null then it would return an Optional, but it doesn’t say that either. Is it documented a…

Java quiz with multi choices in answers

I’m trying to develop a java quiz, here’s the basic idea: A quiz contains n questions, and a question has 0 to n true answers, I have to link that to a database, so my tables are: Table Quiz: Table Question: Table answer: So my java classes are: My Question class: and the same for Answer: The main…