@Test public void testClose() throws Exception { Class<IntentResolver> class1 = IntentResolver.class; PNComputationUnit pnComputationUnit = mock(PNComputationUnit.class); VNComputationUnit vnComputationUnit = mock(VNComputationUnit.class); Map<UserId, VNComputationUnit> vnComputationUnits = new HashMap<UserId, VNComputationUnit>(); vnComputationUnits.put(userId,vnComputationUnit); PNResourcesTracker pnResourcesTracker = mock(PNResourcesTracker.class); VNMappingUnit vnMappingUnit = mock(VNMappingUnit.class); Field field1 = class1.getDeclaredField("pnComputationUnit"); field1.setAccessible(true); field1.set(intentResolver, pnComputationUnit); Field field2 = class1.getDeclaredField("vnComputationUnits"); field2.setAccessible(true); field2.set(intentResolver, vnComputationUnits); Field field3 = class1.getDeclaredField("pnResourcesTracker"); field3.setAccessible(true); field3.set(intentResolver, pnResourcesTracker); Field field4 = class1.getDeclaredField("vnMappingUnit"); field4.setAccessible(true); field4.set(intentResolver, vnMappingUnit); intentResolver.close(); }
@Override public void close() throws Exception { if ( null != pnComputationUnit ) { pnComputationUnit.close(); } for ( VNComputationUnit vnComputationUnit : vnComputationUnits.values() ) { if ( null != vnComputationUnit ) { vnComputationUnit.close(); } } if ( null != pnResourcesTracker ) { pnResourcesTracker.close(); } if ( null != vnMappingUnit ) { vnMappingUnit.close(); } return; }
IntentResolver implements AutoCloseable { @Override public void close() throws Exception { if ( null != pnComputationUnit ) { pnComputationUnit.close(); } for ( VNComputationUnit vnComputationUnit : vnComputationUnits.values() ) { if ( null != vnComputationUnit ) { vnComputationUnit.close(); } } if ( null != pnResourcesTracker ) { pnResourcesTracker.close(); } if ( null != vnMappingUnit ) { vnMappingUnit.close(); } return; } }
IntentResolver implements AutoCloseable { @Override public void close() throws Exception { if ( null != pnComputationUnit ) { pnComputationUnit.close(); } for ( VNComputationUnit vnComputationUnit : vnComputationUnits.values() ) { if ( null != vnComputationUnit ) { vnComputationUnit.close(); } } if ( null != pnResourcesTracker ) { pnResourcesTracker.close(); } if ( null != vnMappingUnit ) { vnMappingUnit.close(); } return; } IntentResolver(DataBroker dataBroker); }
IntentResolver implements AutoCloseable { @Override public void close() throws Exception { if ( null != pnComputationUnit ) { pnComputationUnit.close(); } for ( VNComputationUnit vnComputationUnit : vnComputationUnits.values() ) { if ( null != vnComputationUnit ) { vnComputationUnit.close(); } } if ( null != pnResourcesTracker ) { pnResourcesTracker.close(); } if ( null != vnMappingUnit ) { vnMappingUnit.close(); } return; } IntentResolver(DataBroker dataBroker); void resolveIntent(UserId userId); @Override void close(); }
IntentResolver implements AutoCloseable { @Override public void close() throws Exception { if ( null != pnComputationUnit ) { pnComputationUnit.close(); } for ( VNComputationUnit vnComputationUnit : vnComputationUnits.values() ) { if ( null != vnComputationUnit ) { vnComputationUnit.close(); } } if ( null != pnResourcesTracker ) { pnResourcesTracker.close(); } if ( null != vnMappingUnit ) { vnMappingUnit.close(); } return; } IntentResolver(DataBroker dataBroker); void resolveIntent(UserId userId); @Override void close();  }