### Question:
DeferJsProcessor extends BaseSurfaceJsProcessor implements JsProcessor { public boolean process(JsRequest jsRequest, JsResponseBuilder builder) throws JsException { JsUri jsUri = jsRequest.getJsUri(); ImmutableList.Builder<JsContent> resp = ImmutableList.builder(); FeatureRegistry featureRegistry = getFeatureRegistry(jsUri); boolean needDefers = false; if (jsUri.isJsload()) { List<FeatureBundle> bundles = getSupportDeferBundles(featureRegistry, jsRequest); for (FeatureBundle bundle : bundles) { needDefers |= appendDeferJsStatements(resp, jsRequest.getJsUri(), bundle); } } if (needDefers) { builder.appendAllJs(getSurfaceJsContents(featureRegistry, FEATURE_NAME)); } builder.appendAllJs(resp.build()); return true; } @Inject  DeferJsProcessor(FeatureRegistryProvider featureRegistryProvider,
      Provider<GadgetContext> context); boolean process(JsRequest jsRequest, JsResponseBuilder builder);  }### Answer:
@Test public void processWithOneNonEmptyFeatureDeferred() throws Exception { JsUri jsUri = mockJsUri(JsCompileMode.CONCAT_COMPILE_EXPORT_ALL, true, LIBS_WITH_DEFER); JsRequest jsRequest = new JsRequest(jsUri, null, false, featureRegistry); JsResponseBuilder jsBuilder = new JsResponseBuilder(); boolean actualReturnCode = processor.process(jsRequest, jsBuilder); assertTrue(actualReturnCode); assertEquals( DEFER_JS_DEB + EXPORT_STRING_1_DEFER, jsBuilder.build().toJsString()); }
@Test public void processWithOneNonEmptyFeatureDeferredNotSupported() throws Exception { JsUri jsUri = mockJsUri(JsCompileMode.CONCAT_COMPILE_EXPORT_ALL, true, LIBS_WITHOUT_DEFER); JsRequest jsRequest = new JsRequest(jsUri, null, false, featureRegistry); JsResponseBuilder jsBuilder = new JsResponseBuilder(); boolean actualReturnCode = processor.process(jsRequest, jsBuilder); assertTrue(actualReturnCode); assertEquals( "", jsBuilder.build().toJsString()); }