/*
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.facebook.litho.testing;

import android.app.Activity;
import com.facebook.litho.ComponentContext;
import com.facebook.litho.testing.assertj.LithoRepresentation;
import org.assertj.core.api.Assertions;
import org.junit.rules.TestRule;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;
import org.robolectric.Robolectric;

public class ComponentsRule implements TestRule {

  private ComponentContext mContext;

  @Override
  public Statement apply(final Statement base, final Description description) {
    return new Statement() {
      @Override
      public void evaluate() throws Throwable {
        final Activity activity = Robolectric.buildActivity(Activity.class).create().get();
        mContext = new ComponentContext(activity);

        Assertions.useRepresentation(new LithoRepresentation(mContext));

        try {
          base.evaluate();
        } finally {
          Assertions.useDefaultRepresentation();
        }
      }
    };
  }

  /** Get a Component Context for this test instance. */
  public ComponentContext getContext() {
    return mContext;
  }
}

@@ -780,24 +780,58 @@
 esentation;%0A
+import javax.annotation.Nullable;%0A
 import org.a
@@ -1072,34 +1072,221 @@
 ate 
-ComponentContext mContext;
+final @Nullable Integer mThemeResId;%0A  private ComponentContext mContext;%0A%0A  public ComponentsRule() %7B%0A    this(null);%0A  %7D%0A%0A  public ComponentsRule(@Nullable Integer themeResId) %7B%0A    mThemeResId = themeResId;%0A  %7D
 %0A%0A  
@@ -1556,24 +1556,111 @@
 te().get();%0A
+        if (mThemeResId != null) %7B%0A          activity.setTheme(mThemeResId);%0A        %7D%0A
         mCon

Remove old context header kotlin component spec