Home » Core Java

Core Java

XPath ends-with example

java-logo

In this example we will learn how to use the ends-with function of XPath. We will start with the introduction of XPath – what it is and how to use it, then we will see the working model of ends-with function. Tools and technologies used in this example are Java 1.7, Maven, Intellij, Saxon. 1. Overview An XPath expression specifies a pattern ...

Read More »

XPath concat Example

java-logo

We studied about Xpath normalize-space() method in the previous example. In this example, we will study how the concat(String s1, String s2, String... s3) method works. The XPath-concat method works similar to the String#concat method. It joins two or more strings into a single string. The argument strings maybe two or more static strings and/or they may be two or ...

Read More »

Mockito Verify Example

mockito-logo

In this article, I am going to show you an example of Mockito Verify. To test the state, we use assert, likewise, to verify the test interactions, we use Mockito.verify. Below are my setup details: I am using Maven – the build tool Eclipse  as the IDE, version Luna 4.4.1. TestNG  is my testing framework, in case you are new to TestNG, please refer TestNG Maven Project ...

Read More »

java.io.Console: New Feature in Java 6

java-logo

System.console() method is used for getting a unique instance of the Class Java.io.Console. Console device is associated with current Java virtual machine running. It is assumed that underlying platform is started from interactive command line. If the virtual machine is started automatically by a background job or a service, it would not have a console. The methods on Console are ...

Read More »

XPath normalize-space example

java-logo

In this example, we will talk about the normalize-space method in XPath. The normalize-space(String s) method is used to normalize a string i.e. to remove any leading or trailing spaces from the string s passed as parameter to the XPath function. We will look at a few examples at the examples to see how the normalize-space method works in an ...

Read More »

Mockito void Method Example

mockito-logo

In Mockito Hello World Example, we have learnt how to stub a non-void method that returns something. Sometimes we may also need to stub a void method which is what I am going to show in this article. Before I start with my example, a bit about my setup: I am using Maven – the build tool Eclipse  as the IDE, version Luna 4.4.1. ...

Read More »

Mockito Spy Example

mockito-logo

In this article, I am going to show you an example of Mockito Spy. There are times when we would like to use most of the original object’s behavior but mock only a portion of it. This is called spying objects, also called as partial mocking. Before I start with the example, let me first brief you about my setup: ...

Read More »

XPath substring example

java-logo

In this example, we will try to see how we can use the sub-string method in the XPath for our use-cases. The sub-string method is used to search for the sub-string in the beginning or the end or anywhere in the XPath node. It can also be used to extract the part of the sub-string from the string by specifying ...

Read More »

Mockito Hello World Example

mockito-logo

You are here, it means either you are interested in the mock objects or you are already aware of Mockito, and you want to see a working example of it. Well…let me first introduce you to Mockito which is an open source mock unit testing framework for Java. In this article, I am going to show you a Hello World example ...

Read More »

Gradle Properties: Build and Configuration Example

gradle-logo

In this detailed Gradle Properties tutorial, we shall see how to access several default properties in Gradle, and how to set our custom properties. Also, what methods are to set these properties and how Gradle processes them. 1. Why should we use Gradle Properties? As developers, we provide high-quality code that is scalable and easy to read; Gradle’s properties allow ...

Read More »
Do you want to know how to develop your skillset and become a ...

Subscribe to our newsletter to start Rocking right now!

To get you started we give you our best selling eBooks for FREE!
Get ready to Rock!
To download the books, please verify your email address by following the instructions found on the email we just sent you.

THANK YOU!

Close