Skip to content

Instantly share code, notes, and snippets.

/**
* For the days you want to be predantic
*/
@Test
public void shouldHaveAPrivateConstructor() throws Exception {
Constructor constructor = EuroSemanticResponse.class.getDeclaredConstructor();
assertTrue("Constructor is not private", Modifier.isPrivate(constructor.getModifiers()));
constructor.setAccessible(true);
@MosesMansaray
MosesMansaray / ConvertObjectToEnumOneLineInstantiation.java
Created November 29, 2016 15:11
Converts Class Object to Enum equivalent
public class ConvertObjectToEnumOneLineInstantiation {
/*
* To:
`HIGHLIGHT("highlight", false, "field", false, "title,description,body", null),`
*
* From:
*
`HIGHLIGHT {
@MosesMansaray
MosesMansaray / TransportClientSniffingTestMain.java
Created October 10, 2016 13:11
TransportClient setup with Sniffing set to true to discover other nodes in the Elasticsearch cluster
package com.euromoney.elasticsearch;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
import org.elasticsearch.client.transport.TransportClient;
import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.common.transport.InetSocketTransportAddress;
public class TransportClientSniffingTestMain {