You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Problem:
To print a concatenated String like "Chennai and Hyderabad and Bangalore and Delhi" from an array ["Chennai", "Hyderabad", > "Bangalore", "Delhi"]
Before StringJoiner
final String delemiter = " and ";
String[] cities = new String[]{"Chennai", "Hyderabad", "Bangalore", "Delhi"};
Using ExpectedException Rule along with PowerMockRule in Junit 4
Using ExpectedException Rule with PowerMockRule in Junit 4
When using PowerMockRule for running the tests with PowerMockRunner then ExpectedExeption rule will not actually catch the exceptions, but throws it as an error. Inorder to make this work we will need to do this actions.
Java Pass By Value with Proof. Do you still think java uses Pass by reference for parameters then prove it!
Java Pass by value example
We would have read in many places that Java uses Pass By Value mechanism for parameter passing, but will still get confused when coming to passing object references to the methods. This gist is to give a more clear understanding of how java treats the object references with adequate proof of working code.
Java uses Pass-By-Value method no doubt about it!
When considering this topic, we need to discuss about 3 variations in java.
Are the Initialization errors in child threads really eaten away by the Executor framework? --- No Definitely Not
Handling Initialization errors in Thread Pools using Executors f/w
If you are here, it means that there is a high chance that you spent alot of time debugging the initialization errors of your
application when used with an ExecutorService thread pool in java; else you might just wanted to know more information to work
with ExecutorServices in java.
Everyone of us knows that eating any exception without reporting is very dangerous, and should never be done.
If any time, you have run junit tests and executed them on your code, you should have already observed that the test execution order for JUnit is not what you expected to be. The reason for this behaviour of Junit is because it uses Java Reflections to select and execute the test methods.
Did you ever wanted to execute your Unit tests in deterministic order? If yes we have got a way to do that in JUnit 4.
Inorder to exuecute the Unit tests in a fixed or deterministic order, you have got to decorate your TestClass with @FixedOrder annotation.
@FixedOrder annotation will take the parameter of the MethodSorters enum for sorting the test method execution order.
At times, we might need to change the system time for working on some developmental and testing activities. Setting a new time is always easier, and pretty straight forward in many operating systems.
Have you ever wondered how to reset / resync the correct timestamp.
Yes, I thought so. We will try setting it back again to the correct time, instead of re-synching with the time server. Resetting the time using a time server is pretty easy, and you can do that just in a couple of steps, stated below.