java - Unit testing OdataFeed -
i have java class, takes odatafeed input, processes , pushed rabbitmq. writing junit testing this, input odatafeed json, have sample sample json format, how convert odatafeed.
@override public void process(exchange exchange) throws exception { gson gson = new gsonbuilder().serializenulls().create(); list<map<string, object>> list = gson.fromjson(json, list.class); maps = setentriesmap(list, maps); odatafeed feed = (odatafeed) exchange.getin().getbody();
in junit, have string
string result = "<json>"; byte[] array = result.getbytes(); camelcontext ctx = new defaultcamelcontext(); exchange ex = new defaultexchange(ctx); ex.getin().setheader("rabbitmq", "rabbitmq"); ex.getin().setbody(array);
since required input odatafeed, not able convert string odatafeed. need here, how unit test component. , looking basic tutorials in jmockit, have few other classes calls httprequest , kiewb in flow, need advice in mocking components
Comments
Post a Comment