diff --git a/lib/javatests/com/google/android/material/color/AndroidManifest.xml b/lib/javatests/com/google/android/material/color/AndroidManifest.xml
new file mode 100644
index 00000000000..25a35a71804
--- /dev/null
+++ b/lib/javatests/com/google/android/material/color/AndroidManifest.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
diff --git a/lib/javatests/com/google/android/material/color/DynamicColorsTest.java b/lib/javatests/com/google/android/material/color/DynamicColorsTest.java
new file mode 100644
index 00000000000..17aea9c58e0
--- /dev/null
+++ b/lib/javatests/com/google/android/material/color/DynamicColorsTest.java
@@ -0,0 +1,279 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * 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.google.android.material.color;
+
+import com.google.android.material.R;
+
+import static androidx.test.core.app.ApplicationProvider.getApplicationContext;
+import static com.google.common.truth.Truth.assertThat;
+
+import android.app.Activity;
+import android.app.Application;
+import android.content.Context;
+import android.os.Build;
+import android.os.Build.VERSION_CODES;
+import android.os.Bundle;
+import androidx.appcompat.view.ContextThemeWrapper;
+import com.google.android.material.color.DynamicColors.Precondition;
+import com.google.android.material.resources.MaterialAttributes;
+import com.google.common.collect.ImmutableList;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.robolectric.ParameterizedRobolectricTestRunner;
+import org.robolectric.ParameterizedRobolectricTestRunner.Parameter;
+import org.robolectric.ParameterizedRobolectricTestRunner.Parameters;
+import org.robolectric.Robolectric;
+import org.robolectric.shadow.api.Shadow;
+import org.robolectric.shadows.ShadowContextThemeWrapper;
+import org.robolectric.util.ReflectionHelpers;
+
+/** Tests the logic of {@link com.google.android.material.color.DynamicColors} utility class. */
+@RunWith(ParameterizedRobolectricTestRunner.class)
+public class DynamicColorsTest {
+ @Parameter(0)
+ public String testName;
+
+ @Parameter(1)
+ public int baseTheme;
+
+ private final MockApplication mockApplication = new MockApplication();
+
+ private Activity mockActivity;
+
+ @Parameters(name = "{0}")
+ public static ImmutableList