### Question:
DataBaseEventExtractor { public JasmineEventEB[] getQoSEvents(final Date from, final Date to, final int nbrecords) throws NamingException, ParseException, IOException { if (!configdone) { setConfig(); } ClassLoader saved = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader( AdapterService.class.getClassLoader()); JasmineEventEB[] events = null; try { events = getBean().getEvents("qos-event", null, null, null, null, from, to, "timestamp", 0, nbrecords); } finally { Thread.currentThread().setContextClassLoader(saved); } return events; } DataBaseEventExtractor();  DataBaseEventExtractor(JasmineEventSLBRemote remote); JasmineEventEB[] getEvents(final Collection<String> servers,
			final Collection<String> probes, final Date from, final Date to,
			final int nbrecords); JasmineEventEB[] getQoSEvents(final Date from, final Date to,
			final int nbrecords); void finished();  }### Answer:
@Test public void getQoSEventsTest() throws ParseException, NamingException, IOException{ SimpleDateFormat formate = new SimpleDateFormat("yyyy-MM-dd_HH:mm"); Date from=formate.parse("2012-07-01_12:00"); Date t1=formate.parse("2012-07-05_12:00"); Date to=formate.parse("2012-07-11_12:00"); JasmineEventEB ev1=new JasmineEventEB("qos-event", "server", "source", "probe", 10, t1, "sname"); JasmineEventEB[] events = new JasmineEventEB[1]; events[0]=ev1; JasmineEventSLBRemote mockremote = mock(JasmineEventSLBRemote.class); when(mockremote.getEvents("qos-event", null, null, null, null, from, to, "timestamp", 0, 10)).thenReturn(events); DataBaseEventExtractor dbee=new DataBaseEventExtractor(mockremote); JasmineEventEB[] response =dbee.getQoSEvents(from, to, 10); assertEquals(response[0].getDomain(),"qos-event"); assertEquals(response[0].getValue(),10); }