### Question:
ServicePluginFactory { @SuppressWarnings("unchecked") public String doTPResourcesAllocation(DelegateExecution execution, String uuiRequest) { Map<String, Object> uuiObject = getJsonObject(uuiRequest, Map.class); if (uuiObject == null) { return uuiRequest; } Map<String, Object> serviceObject = (Map<String, Object>) uuiObject.getOrDefault("service", Collections.emptyMap()); Map<String, Object> serviceParametersObject = (Map<String, Object>) serviceObject.getOrDefault("parameters", Collections.emptyMap()); Map<String, Object> serviceRequestInputs = (Map<String, Object>) serviceParametersObject.getOrDefault("requestInputs", Collections.emptyMap()); if (!isNeedAllocateCrossTPResources(serviceRequestInputs)) { return uuiRequest; } allocateCrossTPResources(execution, serviceRequestInputs); return getJsonString(uuiObject); } private  ServicePluginFactory(); static synchronized ServicePluginFactory getInstance(); @SuppressWarnings("unchecked") String doProcessSiteLocation(ServiceDecomposition serviceDecomposition, String uuiRequest); @SuppressWarnings("unchecked") String doTPResourcesAllocation(DelegateExecution execution, String uuiRequest); Map getTPsfromAAI(String serviceName); String preProcessService(ServiceDecomposition serviceDecomposition, String uuiRequest); String doServiceHoming(ServiceDecomposition serviceDecomposition, String uuiRequest); static void main(String args[]); static String getJsonString(Object srcObj);  }### Answer:
@Test public void doTPResourcesAllocation_uuiObjectNull() { String faultyJsonInput = "site_address,sotncondition_clientsignal"; String result = servicePluginFactory.doTPResourcesAllocation(null, faultyJsonInput); Assert.assertEquals(result, faultyJsonInput); }
@Test public void doTPResourcesAllocation_isNeedAllocateCrossTPResources() { String jsonWithOnlyNeededValues = "{\"site_address\":\"\",\"sotncondition_clientsignal\":\"\"}"; String result = servicePluginFactory.doTPResourcesAllocation(null, jsonWithOnlyNeededValues); Assert.assertEquals(result, jsonWithOnlyNeededValues); }