Java Code Examples for org.robolectric.ParameterizedRobolectricTestRunner#Parameters

The following examples show how to use org.robolectric.ParameterizedRobolectricTestRunner#Parameters . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: KeyCodeParameterizedTest.java    From Connect-SDK-Android-Core with Apache License 2.0 6 votes vote down vote up
@ParameterizedRobolectricTestRunner.Parameters
public static Collection<Object[]> data() {
    return Arrays.asList(
        new Object[][] {
            {0},
            {1},
            {2},
            {3},
            {4},
            {5},
            {6},
            {7},
            {8},
            {9},
            {10},
            {11},
            {12},
            {13},
            {14},
        }
    );
}
 
Example 2
Source File: SchemaManagerMigrationTest.java    From firebase-android-sdk with Apache License 2.0 5 votes vote down vote up
@ParameterizedRobolectricTestRunner.Parameters(name = "lowVersion = {0}, highVersion = {1}")
public static Collection<Object[]> data() {
  Collection<Object[]> params = new ArrayList<>();
  for (int fromVersion = 1; fromVersion < SCHEMA_VERSION; fromVersion++) {
    for (int toVersion = fromVersion + 1; toVersion <= SCHEMA_VERSION; toVersion++) {
      params.add(new Object[] {fromVersion, toVersion});
    }
  }
  return params;
}
 
Example 3
Source File: RestartableSetTest.java    From satellite with MIT License 5 votes vote down vote up
@ParameterizedRobolectricTestRunner.Parameters(name = "{0} {1}")
public static Collection<Object[]> parameters() {
    ArrayList<Object[]> variants = new ArrayList<>();
    for (int restartable = 0; restartable < 4; restartable++)
        for (int method = 0; method < 4; method++)
            variants.add(new Object[]{restartable, method});
    return variants;
}
 
Example 4
Source File: VisibilityEventsWithVisibilityExtensionTest.java    From litho with Apache License 2.0 5 votes vote down vote up
@ParameterizedRobolectricTestRunner.Parameters(
    name = "useMountDelegateTarget={0}, useVisibilityExtensionInMountState={1}")
public static Collection data() {
  return Arrays.asList(
      new Object[][] {
        {false, true},
        {true, false}
      });
}
 
Example 5
Source File: TargetSizeTest.java    From scissors with Apache License 2.0 5 votes vote down vote up
@ParameterizedRobolectricTestRunner.Parameters(name = "{2} viewport = [{0}x{1}]")
public static Collection<Object[]> data() {
    return Arrays.asList(new Object[][] {
            { 100, 100, SQUARED },
            { 100, 56, LANDSCAPE },
            { 56, 100, PORTRAIT }
    });
}
 
Example 6
Source File: MountStateIncrementalMountTest.java    From litho with Apache License 2.0 5 votes vote down vote up
@ParameterizedRobolectricTestRunner.Parameters(
    name =
        "useMountDelegateTarget={0}, delegateToRenderCoreMount={1}, useIncrementalMountExtensionInMountState={2}")
public static Collection data() {
  return Arrays.asList(
      new Object[][] {
        {false, false, false},
        {true, false, false},
        {true, true, false},
        {false, false, true}
      });
}
 
Example 7
Source File: VisibilityEventsTest.java    From litho with Apache License 2.0 5 votes vote down vote up
@ParameterizedRobolectricTestRunner.Parameters(
    name =
        "useMountDelegateTarget={0}, delegateToRenderCore={1}, useVisibilityExtensionInMountState={2}, useIncrementalMountExtensionInMountState={3}")
public static Collection data() {
  return Arrays.asList(
      new Object[][] {
        {false, false, false, false},
        {true, false, false, false},
        {false, false, true, false},
        {true, false, true, false},
        {false, false, true, true},
        {true, true, false, false}
      });
}
 
Example 8
Source File: FontSizePreferenceTest.java    From materialistic with Apache License 2.0 5 votes vote down vote up
@ParameterizedRobolectricTestRunner.Parameters
public static List<Object[]> provideParameters() {
    return Arrays.asList(
            new Object[]{0, R.style.AppTextSize_XSmall},
            new Object[]{1, R.style.AppTextSize},
            new Object[]{2, R.style.AppTextSize_Medium},
            new Object[]{3, R.style.AppTextSize_Large},
            new Object[]{4, R.style.AppTextSize_XLarge}
    );
}
 
Example 9
Source File: MeasurementSpec.java    From android-perftracking with MIT License 5 votes vote down vote up
@ParameterizedRobolectricTestRunner.Parameters(name = "Action = {0}, Input = {1}")
public static Collection<Object[]> data() {
  return Arrays.asList(
      new Object[][] {
        {Action.START, null},
        {Action.START, ""},
        {Action.START, "appQ\\"},
        {Action.START, "appQ\""},
        {Action.END, null},
        {Action.END, ""},
        {Action.END, "appQ\\"},
        {Action.END, "appQ\""},
        {Action.START_AGGREGATED, Pair.create(null, null)},
        {Action.START_AGGREGATED, Pair.create("", null)},
        {Action.START_AGGREGATED, Pair.create("valid", null)},
        {Action.START_AGGREGATED, Pair.create("appQ\\", null)},
        {Action.START_AGGREGATED, Pair.create("appQ\"", null)},
        {Action.START_AGGREGATED, Pair.create("appQ\\", "Object")},
        {Action.START_AGGREGATED, Pair.create("appQ\"", "Object")},
        {Action.END_AGGREGATED, Pair.create(null, null)},
        {Action.END_AGGREGATED, Pair.create("", null)},
        {Action.END_AGGREGATED, Pair.create("valid", null)},
        {Action.END_AGGREGATED, Pair.create("appQ\\", null)},
        {Action.END_AGGREGATED, Pair.create("appQ\"", null)},
        {Action.END_AGGREGATED, Pair.create("appQ\\", "Object")},
        {Action.END_AGGREGATED, Pair.create("appQ\"", "Object")}
      });
}
 
Example 10
Source File: RegistrationResponseTest.java    From AppAuth-Android with Apache License 2.0 5 votes vote down vote up
/**
 * TODO .
 */
@ParameterizedRobolectricTestRunner.Parameters(name = "Missing parameter = {0}")
public static Collection<Object[]> data() {
    return Arrays.asList(new Object[][]{
            {RegistrationResponse.PARAM_CLIENT_SECRET_EXPIRES_AT},
            {RegistrationResponse.PARAM_REGISTRATION_ACCESS_TOKEN},
            {RegistrationResponse.PARAM_REGISTRATION_CLIENT_URI}
    });
}
 
Example 11
Source File: RippleUtilsShouldDrawRippleCompatTest.java    From material-components-android with Apache License 2.0 5 votes vote down vote up
/**
 * Parameterized test data for this class. Returns a {@link List} of {@link Object} arrays that
 * include:
 * <li>Description of the states set (used for the test name since int[] toString is not very
 *     descriptive)
 * <li>The int[] of states to pass to shouldDrawRippleCompat
 * <li>The expected value of shouldDrawRippleCompat
 */
@ParameterizedRobolectricTestRunner.Parameters(name = "States: {0} Result: {2}")
public static List<Object[]> getTestData() {
  Object[][] data = {
    {"disabled", new int[] {}, false},
    {"disabled, pressed", new int[] {android.R.attr.state_pressed}, false},
    {"enabled", new int[] {android.R.attr.state_enabled}, false},
    {
      "enabled, pressed",
      new int[] {android.R.attr.state_enabled, android.R.attr.state_pressed},
      true
    },
    {
      "enabled, focused",
      new int[] {android.R.attr.state_enabled, android.R.attr.state_focused},
      true
    },
    {
      "enabled, pressed, focused",
      new int[] {
        android.R.attr.state_enabled, android.R.attr.state_pressed, android.R.attr.state_focused
      },
      true
    },
    {
      "enabled, hovered",
      new int[] {android.R.attr.state_enabled, android.R.attr.state_hovered},
      true
    },
  };
  return Arrays.asList(data);
}
 
Example 12
Source File: PreferencesMigrationTest.java    From materialistic with Apache License 2.0 5 votes vote down vote up
@ParameterizedRobolectricTestRunner.Parameters
public static List<Object[]> provideParameters() {
    return Arrays.asList(
            new Object[]{R.string.pref_item_click, true,
                    R.string.pref_story_display, R.string.pref_story_display_value_comments},
            new Object[]{R.string.pref_item_search_recent, false,
                    R.string.pref_search_sort, R.string.pref_search_sort_value_default}
    );
}
 
Example 13
Source File: ImageRequestBuilderCacheEnabledTest.java    From fresco with MIT License 5 votes vote down vote up
@ParameterizedRobolectricTestRunner.Parameters(name = "URI of scheme \"{0}://\"")
public static Collection<Object[]> data() {
  return Arrays.asList(
      new Object[][] {
        {"asset", false},
        {"content", false},
        {"data", false},
        {"file", false},
        {"http", true},
        {"https", true},
        {"res", false},
      });
}
 
Example 14
Source File: PopularActivityTest.java    From materialistic with Apache License 2.0 5 votes vote down vote up
@ParameterizedRobolectricTestRunner.Parameters
public static List<Object[]> provideParameters() {
    return Arrays.asList(
            new Object[]{R.id.menu_range_day, AlgoliaPopularClient.LAST_24H, R.string.popular_range_last_24h},
            new Object[]{R.id.menu_range_week, AlgoliaPopularClient.PAST_WEEK, R.string.popular_range_past_week},
            new Object[]{R.id.menu_range_month, AlgoliaPopularClient.PAST_MONTH, R.string.popular_range_past_month},
            new Object[]{R.id.menu_range_year, AlgoliaPopularClient.PAST_YEAR, R.string.popular_range_past_year}
    );
}
 
Example 15
Source File: ThemePreferenceTest.java    From materialistic with Apache License 2.0 5 votes vote down vote up
@ParameterizedRobolectricTestRunner.Parameters
public static List<Object[]> provideParameters() {
    return Arrays.asList(
            new Object[]{R.id.theme_dark, R.style.AppTheme_Dark},
            new Object[]{R.id.theme_light, R.style.AppTheme_DayNight}
    );
}
 
Example 16
Source File: BetterImageSpanTest.java    From fresco with MIT License 4 votes vote down vote up
@ParameterizedRobolectricTestRunner.Parameters
public static Collection<Object[]> data() {
  return Arrays.asList(
      new Object[][] {
        {
          "Center - small drawable",
          BetterImageSpan.ALIGN_CENTER,
          10,
          -20,
          10,
          -20,
          10,
          -25,
          15,
          -25,
          15
        },
        {
          "Center - large drawable",
          BetterImageSpan.ALIGN_CENTER,
          50,
          -20,
          10,
          -30,
          20,
          -25,
          15,
          -30,
          20
        },
        {
          "Baseline - small drawable",
          BetterImageSpan.ALIGN_BASELINE,
          10,
          -20,
          10,
          -20,
          10,
          -25,
          15,
          -25,
          15
        },
        {
          "Baseline - large drawable",
          BetterImageSpan.ALIGN_BASELINE,
          50,
          -20,
          10,
          -50,
          10,
          -25,
          15,
          -50,
          15
        },
        {
          "Bottom - small drawable",
          BetterImageSpan.ALIGN_BOTTOM,
          10,
          -20,
          10,
          -20,
          10,
          -25,
          15,
          -25,
          15
        },
        {
          "Bottom - large drawable",
          BetterImageSpan.ALIGN_BOTTOM,
          50,
          -20,
          10,
          -40,
          10,
          -25,
          15,
          -40,
          15
        }
      });
}
 
Example 17
Source File: MetricSpec.java    From android-perftracking with MIT License 4 votes vote down vote up
@ParameterizedRobolectricTestRunner.Parameters(name = "Input = {0}")
public static Collection<Object[]> data() {
  return Arrays.asList(new Object[][] {{null}, {""}, {"appQ\\"}, {"appq\""}});
}
 
Example 18
Source File: ComponentUtilsTest.java    From litho with Apache License 2.0 4 votes vote down vote up
@ParameterizedRobolectricTestRunner.Parameters(name = "{0}")
public static Collection data() {
  return Arrays.asList(new Object[][] {{true}, {false}});
}
 
Example 19
Source File: SQLiteLocalStoreTest.java    From firebase-android-sdk with Apache License 2.0 4 votes vote down vote up
@ParameterizedRobolectricTestRunner.Parameters(name = "QueryEngine = {0}")
public static Collection<Object[]> data() {
  return Arrays.asList(
      new Object[] {new SimpleQueryEngine()}, new Object[] {new IndexFreeQueryEngine()});
}
 
Example 20
Source File: MemoryLocalStoreTest.java    From firebase-android-sdk with Apache License 2.0 4 votes vote down vote up
@ParameterizedRobolectricTestRunner.Parameters(name = "QueryEngine = {0}")
public static Collection<Object[]> data() {
  return Arrays.asList(
      new Object[] {new SimpleQueryEngine()}, new Object[] {new IndexFreeQueryEngine()});
}