Sometimes, we have a situation when we need to create the JUnit test-cases at runtime. For example, we do have a file which has n number of test cases with different inputs, so we can create n number of JUnit test cases at runtime. So we have to extend the features of JUnit to provide the reusability of tests. So, for the same piece of test logic, we can have n number of JUnit test cases placed with different inputs. I have introduced the custom runner to achieve the same.
Basically, we need to extend the org.junit.runners.BlockJUnit4ClassRunner concrete class in my JUnitFactoryRunner concrete class. JUnitFactoryRunner is a runner that collects and processes methods. There are two concerns — one is collecting the tests and the second is executing them. JUnitFactoryRunner has the ability to hold the number of tests from our test class.
Learning Java can be complex, yet simple at the same time. There are a lot of programmers who want to learn Java but don’t know how to start. Java is an awesome programming language that could easily add some spice to your coding skills.
It can be really difficult at first, I know. There are a lot of resources, and it is hard to tell what is the best way to start learning a new programming language. As I’ve said before, learning your first programming language can be difficult. You need to practice a lot and learning a programming language might take some time. You need to invest some time if you’re learning Java for the first time. However, after the first programming language learned, you can easily keep on going.
Back in early 2014, Oracle released the results of the Java EE community survey, which was created to gather feedback about what developers want to see in Java EE 8. One of the questions in the survey was whether people would like to see an MVC web framework alongside with JSF in Java EE 8. The result was pretty clear. More than 60% of the participants voted "Yes". As a result, JSR 371 (MVC 1.0) was started to work on the new action-based web framework for Java EE.
Fast forward to 2016. JSR 371 has been doing well. The EG released the second early draft review and got a lot of positive feedback. The JSR was moving forward even after Oracle suddenly stopped all work on the Java EE JSRs.
I’m really not sure how I stumbled across this link, but it was a while ago, and I put a reminder in my diary so I’d remember the 20 anniversary of the unveiling of the @deprecated javadoc tag. As such, I thought some reflections on this would make an interesting blog entry.
When Java was first launched, it came with a [fairly limited] set of class libraries. If you search on the Oracle website, you will find archived copies of the JDK going all the way back to JDK 1.1, but it seems they no longer maintain a link to JDK 1.0. After some digging through the vast sea of data I’ve collected over the last 20-plus years, I found a copy of the JDK 1.0.2 source code. Having unpacked it, I found that there were 215 classes and interfaces in the standard class libraries (compare that to over 4,500 in JDK 8!). For your amusement, the table below shows the number of public APIs from each major JDK release (Caveat emptor: I did this with a combination of grep and other commands using mostly the javadocs, so I don’t guarantee that it’s 100% accurate.)
A few months ago, I was working a bit on Pdf2Dom in my free time, which is an open source Java PDF-to-HTML converter. At some point, I bumped into PDFs that were using old and obscure Adobe font formats, which we didn’t support quite yet. So, I started Googling about old Adobe font formats and found out if I wanted a pure Java implementation I was on my own, kid.
I decided to break off the new font features to a project that goes by the catchy name of FontVerter, and I learned a few ugly things about how fonts work.
JBoss Modules is quite an interesting project that powers JBoss application server and some other projects in the JBoss ecosystem. However, I was surprised to find out that there isn't much you can find about Modules on the webs. Documentation is... bad half-done, not that many tutorials exist, and no good examples of how you could use this awesome library in your project. The best you can find is the description on how to apply JBoss Modules within the application server. (sad panda)
I was looking for the simplest "Hello World" example and couldn't find it. Well, why not create one myself then?
Refer to Introducing Dexecutor, to get an introduction on Dexecutor and to understand the problem we would solve in a distributed fashion. In short:
One of the most appealing features of Java 8 streams is the ability to seamlessly parallelize operations. However, failing to understand how stream parallelism works may lead to inefficient code. In this article, we look under the hood of Java 8 streams and learn about the Streamplify library, which offers a series of useful streams (most of them related to combinatorics) and helps you implement your own efficient parallel streams in situations where the standard Java libraries do not provide appropriate solutions.
A key role in enabling parallel operations on streams is played by Spliterators. As the name suggests, a spliterator resembles an iterator and has additionally the ability to split itself. Spliterators cover the elements of a source, which can be, for example, an array, a Collection, an I/O channel, or a generator function. The most important methods declared by the Spliterator interface are: tryAdvance, forEachRemaining and trySplit.
For a proper understanding of this article, I'd like you to close your eyes and imagine something. But because having closed eyes and reading at the same time is not an option, we'll skip the "close your eyes" part and jump straight into "imagine."Intro
Imagine you're going to a big dance party with your crush. You're really into him/her, so you don't want to mess up. You want to be sexy, charming and funny. Now, WHAT COULD POSSIBLY GO WRONG?
We're going to have little ado and cut right to the chase. With Spring Framework 5.0's release, one of the cool new features is functional reactive endpoints. Sit down, settle in, and watch as we spend the next 30 minutes detailing how they work and what you can do with them.
We know that we can delegate query creation to Spring Data. Spring Data is smart enough to derive queries based on the method name. But sometimes, delegation doesn't suit our needs. The way Spring Data creates the query doesn't meet our requirements, so we need to customize the query. Using the @Query annotation, we can customize our query and instruct Spring data to take this customize query, not yours.When the @Query Annotation Is Needed
Suppose you want to build a query that takes a variety of filtered criteria. Say I want to fetch "Person" based on name, country, gender, and age. We can achieve this via a Spring Data method convention, like findPersonbyNameAndCountryAndGenderAndAge but the readability is pretty bad. So, let's avoid this and use the @Query annotation and create your own query with a suitable method name.
@Query("select p from Person p where p.name like ?1 and p.country like
?2 and gender like ?3 and age=?4 order by country")
findPerson(String name,String country,String gender,Integer age);
You must have seen a Hadoop word count program in Java, Python, or in C/C++ before, but probably not in Scala. So, let's learn how to build a word count program in Scala.
Submitting a job that is written in Scala to Hadoop is not that easy because Hadoop runs on Java so it doesn't understand the functional aspect of Scala.
If you’re a member of the tech industry then you’ve probably had to work with legacy code — those ancient systems that just hold everything together. Not every project is greenfield, thus “Working Effectively with Legacy Code” by Michael Feathers is a book that has a reputation that would provide a good insight into how we could improve our relationships with these necessary systems and provide a better service to our customers. This blog post will share of some the key takeaways from the book.What Is Legacy Code?
In a world where continuous delivery is on every company’s radar, it’s important to accept that legacy code exists and you’re going to be required to bring it into the fold. One of the key aspects of a successful continuous delivery model is the feedback loop. Your developers and your businesses build confidence in your ability to make changes through testing. Static analysis, unit testing, integration testing, and performance testing are all the difference between having a continuously deployed application and a high risk, rarely changed legacy codebase.