Category "java"

Mockito can not mock Random in Java 17

Trying to update my project from Java 11 to Java 17 and got an unexpected error from Mockito in a specific test. mock(java.util.Random.class); Throws Feb 04, 2

problem configuring CORSin spring boot and reactjs

After reading all the MDN docs on CORS, I am trying to fetch resources at a spring boot server at localhost:8080 from a ReactJS app at localhost:3000, yet i can

What will this assertEquals() in junit return?

Does the assertEquals function result in? WIll this fail beccause assertEquals() requires tolerance value for double comparison? import java.util.*; class

Java concurrent deadlock

Run the Main.main() method seems like a deadlock has occurred. I found out it can be fixed if replace notify() with notifyAll(). But why? Shouldn't the worst ca

Printing all the paths in a tree from root to each leaf

I am trying to print all the paths from root to leaf in a tree, but having some issues collecting the path items. Consider the following graph: In my case thou

How can I get the Minecraft class loader?

I'm loading an agent to Minecraft JVM and when I get all the loaded classes from the instrumentation, most of them are not there. My code looks like Class.forNa

How to remove Keys that would cause Collisions before executing Collectors.toMap()

I have a stream of objects similar to this previous question, however, instead of ignoring duplicate values, I would like to remove any values from that stream

Spring Boot 2 preventing Tomcat 9 from shutting down

I am having an issue where a Tomcat server fails to shut down correctly when it has a Spring Boot web application. This causes issues with scheduled tasks and b

Gradle Build Failed after updated to 7.4.1 in windows 10 for java 8 project

Getting error like this What went wrong: Unable to start the daemon process. This problem might be caused by incorrect configuration of the daemon. For example,

Location of toString() Method of java.util.LinkedList

I am studying LinkedLists and wanted to check Java's implementation. However, I have some questions. I saw that I can print the contents of java.util.LinkedList

Can I configure the pool size of a specific Quarkus Vertx ConsumeEvent?

The parameter quarkus.vertx.worker-pool-size allows me to configure the "Thread size of the worker thread pool", according to the quarkus guide - All configurat

Restricting browser drivers in selenium

I am a newbie to selenium. Just wanted to know how do I restrict the script to take only one version of a browser. I dont want to update my browser driver again

Use DBUnit in Spring without defined entities via "nativequery"

I am trying to use DBunit while testing a Spring controller. The tests fail to initialize because my dataset contains tables/columns which are not defined by an

System of linear equations Thomas algorithm Java

I have adapted the Thomas Algorithm for solving the tridiagonal matrix problem i.e. finding the value of the vector T in the equation AT = b where A and b are k

Mimicking compile time interfaces in python

Summary This question first uses Java examples to demonstrate what I am trying to achieve, then shows Python equivalents where I attempt to replicate the compil

UnmarshallerImpl finalize() method leads to memory leak

I'm using webServiceTemplate in my multithread Spring app. There are my jaxb dependencies: compile('javax.xml.bind:jaxb-api:2.3.0') compile('org.glassfish.jaxb:

Adding Javalin dependencies

I'm trying to use Javalin in my project and I can't seem to understand how to add the needed dependencies in order to work with Javalin without compliation erro

How Do You Make an Object From an Inheritance Class in Java?

EDITED: Looks a little cleaner now, reflects where I currently am and what I'm trying to accomplish, and shows the new issue I'm working on (which has a comment

how can I push notifications using data already built in SQLite?

I'm currently developing a notification type Android app, how can I push notifications using data already built in SQLite? Data table fields: [notification titl

Java multiplication (in the type PrintStream is not applicable for the arguments (String, int)) [closed]

Table of a any number getting this error - on System.out.println(number+" x "+i+" = ",+number*i); (in the type PrintStream is not applicable f