1010public class ActivityIntentFragmentTest extends AAProcessorTestHelper {
1111
1212 // Couldn't find better than this for now
13- private static final String INTENT_FRAGMENT_SIGNATURE = "public static ActivityInManifest_.IntentBuilder_ intent( Fragment fragment) " ;
14- private static final String INTENT_FRAGMENT_SUPPORT_SIGNATURE = "public static ActivityInManifest_.IntentBuilder_ intent( Fragment supportFragment) " ;
13+ private static final String INTENT_FRAGMENT_SIGNATURE = ".* public static ActivityInManifest_\\ .IntentBuilder_ intent\\ ((android \\ .app \\ .)? Fragment fragment\\ ).* " ;
14+ private static final String INTENT_FRAGMENT_SUPPORT_SIGNATURE = ".* public static ActivityInManifest_\\ .IntentBuilder_ intent\\ ((android \\ .support \\ .v4 \\ .app \\ .)? Fragment supportFragment\\ ).* " ;
1515
1616 @ Before
1717 public void setup () {
@@ -25,7 +25,7 @@ public void activity_intentFragment_minSdkFroyo_compileWithFroyo() {
2525 File generatedFile = toGeneratedFile (ActivityInManifest .class );
2626
2727 assertCompilationSuccessful (result );
28- assertGeneratedClassDoesntContains (generatedFile , INTENT_FRAGMENT_SIGNATURE );
28+ assertGeneratedClassDoesntMatches (generatedFile , INTENT_FRAGMENT_SIGNATURE );
2929 }
3030
3131 @ Test
@@ -36,7 +36,7 @@ public void activity_intentFragment_minSdkFroyo_compileWithJB() {
3636 File generatedFile = toGeneratedFile (ActivityInManifest .class );
3737
3838 assertCompilationSuccessful (result );
39- assertGeneratedClassDoesntContains (generatedFile , INTENT_FRAGMENT_SIGNATURE );
39+ assertGeneratedClassDoesntMatches (generatedFile , INTENT_FRAGMENT_SIGNATURE );
4040 }
4141
4242 @ Test
@@ -47,7 +47,7 @@ public void activity_intentFragment_minSdkJB_compileWithJB() {
4747 File generatedFile = toGeneratedFile (ActivityInManifest .class );
4848
4949 assertCompilationSuccessful (result );
50- assertGeneratedClassContains (generatedFile , INTENT_FRAGMENT_SIGNATURE );
50+ assertGeneratedClassMatches (generatedFile , INTENT_FRAGMENT_SIGNATURE );
5151 }
5252
5353 @ Test
@@ -59,7 +59,19 @@ public void activity_intentFragment_compileWithSupport() {
5959 File generatedFile = toGeneratedFile (ActivityInManifest .class );
6060
6161 assertCompilationSuccessful (result );
62- assertGeneratedClassContains (generatedFile , INTENT_FRAGMENT_SUPPORT_SIGNATURE );
62+ assertGeneratedClassMatches (generatedFile , INTENT_FRAGMENT_SUPPORT_SIGNATURE );
63+ }
64+
65+ @ Test
66+ public void activity_intentFragment_minSdkJB_compileWithJBAndSupport () {
67+ // To simulate compilation with SDK > 11, we add Fragment in classpath
68+ addManifestProcessorParameter (ActivityIntentFragmentTest .class , "AndroidManifestMinJB.xml" );
69+ CompileResult result = compileFiles (toPath (ActivityIntentFragmentTest .class , "Fragment.java" ), toPath (ActivityIntentFragmentTest .class , "support/Fragment.java" ), ActivityInManifest .class );
70+ File generatedFile = toGeneratedFile (ActivityInManifest .class );
71+
72+ assertCompilationSuccessful (result );
73+ assertGeneratedClassMatches (generatedFile , INTENT_FRAGMENT_SIGNATURE );
74+ assertGeneratedClassMatches (generatedFile , INTENT_FRAGMENT_SUPPORT_SIGNATURE );
6375 }
6476
6577}
0 commit comments