Learn how to capture method arguments using Spock’s Stubs, Mocks, and Spies using Closures.
Search Results for: Method invocation
Get All Results at Once in a Spring Boot Paged Query Method
Revisit how to retrieve data in pagination using Spring Boot how to retrieve all results at once using pagination
Printing Message on Console without Using main() Method in Java
Explore ways of printing messages without the main() method in Java.
Invoke Spring @Cacheable from Another Method of Same Bean
A quick and practical guide to invoking @Cacheable methods from other methods of the same bean in Spring.
Mock Same Method with Different Parameters
Learn how to mock a method in Java to receive different responses based on the parameters passed in.
Debugging Spring Method Annotations Using Lightrun
A practical guide to debugging Spring method annotations using Lightrun.
Spring @EnableMethodSecurity Annotation
Learn the main features of @EnableMethodSecurity and how it replaces @EnableGlobalMethodSecurity.
Use Cases for Static Methods in Java
Java allows us to declare functions as static. We look at what this means, how static functions differ from others, and some common use cases for preferring static functions.
Unit Test Private Methods in Java
Why it’s not a good idea to test a private method and how to do it if it’s extremely necessary.
Invoke a Static Method Using Java Reflection API
Learn how to invoke public and private static methods using the Java Reflection API
Spring @EnableWebSecurity vs. @EnableGlobalMethodSecurity
Spring Security in Spring Boot allows a couple of different approaches for setting access rights for our endpoints. We explore both the standard web security module and the JSR–250 approach here.
Mocking Static Methods With Mockito
Explore a couple of examples of how we can use Mockito to mock static methods.
Difference Between when() and doXxx() Methods in Mockito
Learn the advantages and disadvantages of the configuring a mock object the when().thenXxx() or the doXxx().when() way.
<init> and <clinit> Methods in the JVM
See how the compiler and runtime use the init and clinit methods for initialization purposes
What Causes java.lang.reflect.InvocationTargetException?
Learn what Causes java.lang.reflect.InvocationTargetException.
Deny Access on Missing @PreAuthorize to Spring Controller Methods
Learn how to deny access by default on missing PreAuthorize annotations.
Java Default Parameters Using Method Overloading
Learn how to use method overloading to simulate default parameters in Java.
Evaluation of Methods References in Java
Learn about Evaluation of Methods References in Java
Method Inlining in the JVM
Learn about the method inlining in the JVM and how the Just-In-Time compiler achieves it.
Method Handles in Java
See how to use MethodHandles in Java.