Skip to main content

Posts

Showing posts from August, 2021

Project Lombok is New Feature or plugin

Project Lombok is a Java library tool that generates code for minimizing boilerplate code. The library replaces boilerplate code with easy-to-use annotations. For example, by adding a couple of annotations, you can get rid of code clutters, such as getters and setters methods, constructors, hashcode, equals, and toString methods, and so on. We have written a lot of boilerplate code such as getter, setter, equals, hashCode methods etc. in Java for years. In some cases, this causes problems in subjects like clean and readable code. For such situations, Project Lombok saves our eyes  . Also, you will be able to spend more time on the business logic using Lombok. “Never write another getter or equals method again, with one annotation your class has a fully featured builder, Automate your logging variables, and much more.” Project Lombok uses annotations to avoid boilerplate code. In the best cases, only five lines can replace hundreds of lines of code. @Data @AllArgsConstructor @No

What is Java Unit testing, and how do you learn it?

  Unit testing  is an idea to test project unit by unit, part by part. Debugging  isn't part of unit testing but part of testing step by step. Unit tests  ideally should cover all corner cases plus some random inputs for each project's unit to check whether it works properly. JUnit  allows to assure that methods return expected results and throw expected exceptions. It's is integrated with Eclipse to make the whole testing process a bit easier.  Assert () methods throw an exception marking given test as 'failed' when the result of the tested method is different than expected. JUnit can be learned any time depending on your requirements. If you are good with the concepts of the language, then you can start with it else try to get deeper understanding of the things.