Home » Archives for Alvin Reyes » Page 2

Author Archives: Alvin Reyes

Alvin has an Information Technology Degree from Mapua Institute of Technology. During his studies, he was already heavily involved in a number of small to large projects where he primarily contributes by doing programming, analysis design. After graduating, he continued to do side projects on Mobile, Desktop and Web Applications.

JUnit Best Practices

1. Introduction There are a lot of ways on how a developer can do JUnit test cases, but overall it really depends on the strategy of how a specific functional code can be tested to it’s limits. It’s the developers responsibility to introduce thorough test cases to make sure that the code is stable and ultimately does what it has ...

Read More »

JUnit NetBeans Example

1. Introduction In this post I will introduce the basics of writing and running JUnit unit tests in NetBeans IDE. Testing an application is an integral part of the development cycle, and writing and maintaining unit tests can help ensure that the individual methods in your source code work correctly. The IDE’s support for JUnit testing framework allows developers to ...

Read More »

JUnit Test Suite Example

1. Introduction A JUnit Test suite is used to bundle multiple test cases together in a single run. This is usually used if you want to integrated several JUnit Test cases that makes up a specific functionality from the integration. The developer uses the @RunWith and @SuiteClasses to run Suite tests for this purposes. In this example, I’ll be showing a ...

Read More »

JUnit Exception Handling Example

1. Introduction There are popular ways to test exception in JUnit. A developer can use the traditional try-catch statement, the @Rule or the annotation based. In this post, I’ll be discussing these 3 simple and easy to implement ways to make your test case and functional scenarios bulletproof of incoming exceptions. 2. Source(s) In this example, we use the traditional ...

Read More »

Spring JUnit Test Example

In this example, I’ll be showcasing how to do Unit Tests for Spring beans using only annotations. 1. Introduction Spring has its own testing framework for all objects created under its IOC container (that we all know is just the JVM instance). Spring has created its own paradigm of object creation and destruction and it made sense for it to ...

Read More »

JUnit Report Example

1. Introduction In all the test cases of an application, there is always a way to create a report of it one way or the other. JUnit is not an exception to this and there’s a ton of ways to create reports from it. It can even be incorporated to the maven site and have it part of the overall ...

Read More »

JUnit AssertThat Example

1. Introduction The assertThat is one of the JUnit methods from the Assert object that can be used to check if a specific value match to an expected one. It primarily accepts 2 parameters. First one if the actual value and the second is a matcher object. It will then try to compare this two and returns a boolean result ...

Read More »

JUnit SetUp / TearDown Example

1. Introduction When we create JUnit test cases, we would normally setup our own configuration and data objects that can be used on our test cases. We needed them to be readily available when we create each of the method test cases and mock what was actually being used by the system at runtime. We can prepare this within the ...

Read More »

JUnit assertEquals example

1. Introduction To follow through with my previous post about assertTrue and assertFalse, this post will tackle on checking for an equality of a conditional statement on the test cases. There is a method called assertEquals in the JUnit library that can be used to check if two objects is equally defined or not. It can be used to check if ...

Read More »

JUnit assertFalse example

1. Introduction To follow through with my previous post about assertTrue, this will tackle about the exact opposite of that function. The assertFalse. The assertFalse is basically a function that can be used to check if a specific logic or process will return a false statement. This can be in any conditional or structural logic that will return a boolean ...

Read More »