Skip to content

how to define an array without a defined length of it

The question is: get a score of 10 peoples; then you need to ask each one with a score higher than 80 if he would want to continue studying ‘y’ for yes and ‘n’ for no. Next you need to get their location in the array so if person number 5 array[5]=90 and answers ‘y’ it will…

Spring junit tests with couchbase

I have some Services that should get documents from couchbase. Services: Also I have DocRepository interface with necessary methods and views on couchbase server. When I run my app and call Services its work fine, but I need tests for this Services. Tests: Running tests successful only in 90%. And another mom…

Java access bean methods with LambdaMetafactory

my question is strongly related to Explicit use of LambdaMetafactory in that thread, some very good examples are provided to use the LambdaMetafactory to access a static method of a class; however, I wonder what is the equivalent code to access a non static field of an existing bean instance. It seems really …

json date format in spring-boot

I am using spring-boot and I have an entity class defined something like this When this class is converted to JSON, the field gets converted to the following string representation I want to have the json response as yyyy-MM-dd. I tried the @DateTimeFormat(iso = ISO.DATE) annotation and that did not help eithe…

ByteBuffer to int array (each byte)

Related to question byte array to Int Array, however I would like to convert each byte to an int, not each 4-bytes. Is there a better/cleaner way than this: Answer I’d probably prefer

jOOQ: Mocking DAO objects

jOOQ 3.5.0 I’m currently trying to write unit tests for a resource that is using jOOQs generated DAO objects. I’ve noticed one of the base classes (DAOImpl) in the DAO hierarchy has many final methods which makes it unfriendly to mock (I’m excluding byte code manipulators like Powermock as a…