Default image

Pradeep Mishra

Make your own Java Annotations

Annotations, a form of metadata, provide data about a program that is not part of the program itself. Annotations have no direct effect on the operation of the code they annotate. Annotations have been a powerful part of Java, but most times we tend to use them rather than create them.

Passing Data to Future Steps in Spring Batch

An ExecutionContext is a set of key-value pairs containing information that is scoped to either StepExecution or JobExecution. Spring Batch persists the ExecutionContext, which helps in cases where you want to restart a batch run (e.g., when a fatal error has occurred, etc.). All that is needed is to put any object to be shared between steps into the context and the framework will take care of the rest. After restart, the values from the prior ExecutionContext are restored from the database and applied.

Mockito doesn’t give a Hangover – Java Unit Tests

Mockito is a mocking framework. It is a Java-based library used to create simple and basic test APIs for performing unit testing of Java applications. It internally uses the Java Reflection API to generate mock objects for a specific interface. Mockito is in top 10 Java library across all libraries, not only the testing tools.

JUnit Annotations with Example

JUnit is a unit testing framework for the Java programming language. JUnit is used primarily to test each and every unit or component of your application, like classes and methods. It helps to write and run repeatable automated tests to ensure your code runs as intended.

Spark Partitions with Coalesce and Repartition (hash, range, round robin)

One main advantage of the Apache Spark is, it splits data into multiple partitions and executes operations on all partitions of data in parallel which allows us to complete the job faster.While working with partition data we often need to increase or decrease the partitions based on data distribution. Methods repartition and coalesce helps us to repartition.

Scala String Interpolation

Introduction String Interpolation refers to substitution of defined variables or expressions in a given String with respected values. String Interpolation allows users to embed variable references directly in processed string literals. Here’s an example: And, here’s an example which does not uses any…

Multiline Strings in Scala

You want to create multiline strings within your Scala source code, like you can with the heredoc syntax of other languages and help in escaping quotes and other symbols. A heredoc is a way to define a multiline string, whilemaintaining the original indentation &…