mercredi 10 juin 2015

Unit Testing a custom ElasticSearch Client with JUnit

I have created a custom Elastic Search Client by extending the TransportClient of ElasticSearch. I need to deploy unit testing on the various functions by the problem is that how should I go about doing that?

Say for example , in JUnit I use these ->

assertEquals(expectedOutput, actualOutput); 

But here , the problem is there's actually no Output. The Queries execute and things are manipulated in some way. I just want to do the unit testing but I am not getting an idea how to proceed about it.

For example if I want to see if the index() works properly, can I do that? I don't really want to actually index data and check if it has been indexed as I am not doing the integration testing right now, it would make the things complex. Can I do the unit Testing somehow?

I am including a method from my client. If I want to deploy unit testing for the given function , how should I do it?

@Override
        public ActionFuture<IndexResponse> index(IndexRequest request)
            {
                TimerContext indexTimerContext=indexTimer.time();
                super.index(request));
                indexTimerContext.stop();
            }

How should I really go about doing it

Aucun commentaire:

Enregistrer un commentaire