### Question:
FieldAgent implements IOFogModule { public final void postTracking(JsonObject events) { logDebug("Start posting tracking"); try { orchestrator.request("tracking", RequestType.POST, null, events); } catch (Exception e) { logError("Unable send tracking logs", new AgentSystemException(e.getMessage(), e)); } logDebug("Finished posting tracking"); } private  FieldAgent(); @Override int getModuleIndex(); @Override String getModuleName(); static FieldAgent getInstance(); final void postTracking(JsonObject events); JsonObject provision(String key); String deProvision(boolean isTokenExpired); void instanceConfigUpdated(); void start(); void sendUSBInfoFromHalToController(); void sendHWInfoFromHalToController(); String getCheckUpgradeReadyReport(); void changeReadInterval();  }### Answer:
@Test ( timeout = 5000L ) public void testPostTrackingWithValidJsonObject() { try { initiateMockStart(); fieldAgent.postTracking(jsonObject); Mockito.verify(orchestrator).request(eq("tracking"), eq(RequestType.POST), eq(null), eq(jsonObject)); } catch (Exception e) { fail("This should not happen"); } }
@Test ( timeout = 5000L ) public void postTrackingLogsErrorWhenRequestFails() { try { initiateMockStart(); when(orchestrator.request(any(), any(), any(), any())).thenThrow(PowerMockito.mock(Exception.class)); fieldAgent.postTracking(null); Mockito.verify(orchestrator).request(eq("tracking"), eq(RequestType.POST), eq(null), eq(null)); PowerMockito.verifyStatic(LoggingService.class, Mockito.atLeastOnce()); LoggingService.logError(eq(MODULE_NAME), eq("Unable send tracking logs"), any()); } catch (Exception e) { fail("this should never happen"); } }