Specifying an order to junit 4 tests at the Method level (not class level)

I know this is bad practice, but it needs to be done, or I’ll need to switch to testng. Is there a way, similar to JUnit 3’s testSuite, to specify the order of the tests to be run in a class?


Coding Conventions – Naming Enums

Is there a convention for naming enumerations in Java? My preference is that an enum is a type. So, for instance, you have an enum Fruit{Apple,Orange,Banana,Pear, … } NetworkConnectionType{LAN,…

Tags: arrays java

Do Java arrays have a maximum size?

Tags: ,

Is there a limit to the number of elements a Java array can contain? If so, what is it?

When to use Spring Integration vs. Camel?

Tags: , , , ,

As a seasoned Spring user I was assuming that Spring Integration would make the most sense in a recent project requiring some (JMS) messaging capabilities (more details). After some days working with …

Tags: java regex

Very Simple Regex Question

Tags: ,

I have a very simple regex question. Suppose I have 2 conditions: url =http://www.abc.com/cde/def url =https://www.abc.com/sadfl/dsaf How can I extract the baseUrl using regex? Sample output: http:…


update attribute a element in arraylist on java?

I have a class Class TextChunks extends Token { ArrayList arrt = new ArrayList(); } extent fron class : class Token { String s; int frequency = 1 ;// Tern …

How do I programmatically compile and instantiate a Java class?

Tags: , ,

I have the class name stored in a property file. I know that the classes store will implement IDynamicLoad. How do I instantiate the class dynamically? Right now I have Properties foo = new …

How to extract CN from X509Certificate in Java?

Tags: , , ,

I am using a SslServerSocket and client certificates and want to extract the CN from the SubjectDN from the client’s X509Certificate. At the moment I call cert.getSubjectX500Principal().getName() but …

Tags: java maven-2

Can we start the maven build from the point where it failed

Tags: ,

Suppose, I am doing a full build on my large project which has 7 modules and on the 6th module, the build failed because a test failed. Is there any way by which I can start the build from the point …

Java – Collections.sort() performance

Tags: , , ,

I’m using Collections.sort() to sort a LinkedList whose elements implements Comparable interface, so they are sorted in a natural order. In the javadoc documentation its said this method uses …