diff options
author | Jens Nyman <jnyman@google.com> | 2024-01-16 13:54:28 +0000 |
---|---|---|
committer | Jens Nyman <jnyman@google.com> | 2024-01-16 13:54:28 +0000 |
commit | 23b3b22fce920618c5eda062fa36889850098163 (patch) | |
tree | a07542d93f86631036cbe788066a0c61ad29683a | |
parent | b90cb7320ed7dd9b6797e89cacac59ea19d414bf (diff) | |
download | TestParameterInjector-23b3b22fce920618c5eda062fa36889850098163.tar.gz |
Mark test as Google internal because it relies on class.toString()
https://github.com/google/TestParameterInjector/issues/44
-rw-r--r-- | junit4/src/test/java/com/google/testing/junit/testparameterinjector/TestParameterTest.java | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/junit4/src/test/java/com/google/testing/junit/testparameterinjector/TestParameterTest.java b/junit4/src/test/java/com/google/testing/junit/testparameterinjector/TestParameterTest.java index ba4b2f7..61534e6 100644 --- a/junit4/src/test/java/com/google/testing/junit/testparameterinjector/TestParameterTest.java +++ b/junit4/src/test/java/com/google/testing/junit/testparameterinjector/TestParameterTest.java @@ -16,15 +16,11 @@ package com.google.testing.junit.testparameterinjector; import static com.google.common.collect.ImmutableList.toImmutableList; import static com.google.common.collect.Lists.newArrayList; -import static com.google.common.truth.Truth.assertThat; import static java.lang.annotation.RetentionPolicy.RUNTIME; import com.google.common.base.CharMatcher; -import com.google.common.collect.FluentIterable; import com.google.common.collect.ImmutableMap; import com.google.testing.junit.testparameterinjector.SharedTestUtilitiesJUnit4.SuccessfulTestCaseBase; -import com.google.testing.junit.testparameterinjector.TestParameterValuesProvider.Context; -import java.lang.annotation.Annotation; import java.lang.annotation.Retention; import java.util.Arrays; import java.util.Collection; @@ -225,72 +221,6 @@ public class TestParameterTest { } } - @RunAsTest - public static class WithContextAwareValuesProvider extends SuccessfulTestCaseBase { - - @CustomFieldAnnotation - @TestParameter(valuesProvider = InjectContextProvider.class) - private Context contextFromField; - - private final Context contextFromConstructor; - - public WithContextAwareValuesProvider( - @TestParameter(valuesProvider = InjectContextProvider.class) Context context) { - this.contextFromConstructor = context; - } - - @Test - public void contextTest( - @CustomParameterAnnotation1 - @CustomParameterAnnotation2 - @TestParameter(valuesProvider = InjectContextProvider.class) - Context contextFromParameter) { - assertThat(contextFromField.testClass()).isEqualTo(WithContextAwareValuesProvider.class); - assertThat(contextFromConstructor.testClass()) - .isEqualTo(WithContextAwareValuesProvider.class); - assertThat(contextFromParameter.testClass()).isEqualTo(WithContextAwareValuesProvider.class); - - assertThat( - FluentIterable.from(contextFromField.otherAnnotations()) - .transform(Annotation::annotationType) - .toList()) - .containsExactly(CustomFieldAnnotation.class); - assertThat(contextFromConstructor.otherAnnotations()).isEmpty(); - assertThat( - FluentIterable.from(contextFromParameter.otherAnnotations()) - .transform(Annotation::annotationType) - .toList()) - .containsExactly(CustomParameterAnnotation1.class, CustomParameterAnnotation2.class); - - storeTestParametersForThisTest(contextFromParameter); - } - - @Override - ImmutableMap<String, String> expectedTestNameToStringifiedParameters() { - return ImmutableMap.<String, String>builder() - .put( - "contextTest[1.Context(otherAnnotations=[@com.google.testing.junit.tes...,1.Context(otherAnnotations=[],testClass=WithContextAwareV...,1.Context(otherAnnotations=[@com.google.testing.junit.tes...]", - "Context(otherAnnotations=[@com.google.testing.junit.testparameterinjector.TestParameterTest.WithContextAwareValuesProvider.CustomParameterAnnotation1(),@com.google.testing.junit.testparameterinjector.TestParameterTest.WithContextAwareValuesProvider.CustomParameterAnnotation2()],testClass=WithContextAwareValuesProvider)") - .build(); - } - - private static final class InjectContextProvider extends TestParameterValuesProvider { - @Override - public List<?> provideValues(Context context) { - return newArrayList(context); - } - } - - @Retention(RUNTIME) - @interface CustomFieldAnnotation {} - - @Retention(RUNTIME) - @interface CustomParameterAnnotation1 {} - - @Retention(RUNTIME) - @interface CustomParameterAnnotation2 {} - } - @Parameters(name = "{0}") public static Collection<Object[]> parameters() { return Arrays.stream(TestParameterTest.class.getClasses()) |