| 1 |
/* |
| 2 |
* Copyright (C) 2015 The Android Open Source Project |
| 3 |
* |
| 4 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 |
* you may not use this file except in compliance with the License. |
| 6 |
* You may obtain a copy of the License at |
| 7 |
* |
| 8 |
* http://www.apache.org/licenses/LICENSE-2.0 |
| 9 |
* |
| 10 |
* Unless required by applicable law or agreed to in writing, software |
| 11 |
* distributed under the License is distributed on an "AS IS" BASIS, |
| 12 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 |
* See the License for the specific language governing permissions and |
| 14 |
* limitations under the License. |
| 15 |
*/ |
| 16 |
package com.android.ide.common.repository; |
| 17 |
|
| 18 |
import static com.android.SdkConstants.FN_PUBLIC_TXT; |
| 19 |
import static com.android.SdkConstants.FN_RESOURCE_TEXT; |
| 20 |
import static org.easymock.EasyMock.createNiceMock; |
| 21 |
import static org.easymock.EasyMock.expect; |
| 22 |
import static org.easymock.EasyMock.replay; |
| 23 |
import static org.mockito.Mockito.mock; |
| 24 |
import static org.mockito.Mockito.when; |
| 25 |
|
| 26 |
import com.android.builder.model.AndroidArtifact; |
| 27 |
import com.android.builder.model.AndroidLibrary; |
| 28 |
import com.android.builder.model.AndroidProject; |
| 29 |
import com.android.builder.model.Dependencies; |
| 30 |
import com.android.builder.model.MavenCoordinates; |
| 31 |
import com.android.builder.model.Variant; |
| 32 |
import com.android.ide.common.repository.ResourceVisibilityLookup.SymbolProvider; |
| 33 |
import com.android.ide.common.resources.ResourceUrl; |
| 34 |
import com.android.resources.ResourceType; |
| 35 |
import com.android.testutils.TestUtils; |
| 36 |
import com.google.common.base.Charsets; |
| 37 |
import com.google.common.collect.Multimap; |
| 38 |
import com.google.common.io.Files; |
| 39 |
|
| 40 |
import junit.framework.TestCase; |
| 41 |
|
| 42 |
import org.mockito.stubbing.OngoingStubbing; |
| 43 |
|
| 44 |
import java.io.File; |
| 45 |
import java.io.IOException; |
| 46 |
import java.util.Arrays; |
| 47 |
import java.util.Collections; |
| 48 |
import java.util.List; |
| 49 |
|
| 50 |
public class ResourceVisibilityLookupTest extends TestCase { |
| 51 |
public void test() throws IOException { |
| 52 |
AndroidLibrary library = createMockLibrary( |
| 53 |
"com.android.tools:test-library:1.0.0", |
| 54 |
"" |
| 55 |
+ "int dimen activity_horizontal_margin 0x7f030000\n" |
| 56 |
+ "int dimen activity_vertical_margin 0x7f030001\n" |
| 57 |
+ "int id action_settings 0x7f060000\n" |
| 58 |
+ "int layout activity_main 0x7f020000\n" |
| 59 |
+ "int menu menu_main 0x7f050000\n" |
| 60 |
+ "int string action_settings 0x7f040000\n" |
| 61 |
+ "int string app_name 0x7f040001\n" |
| 62 |
+ "int string hello_world 0x7f040002", |
| 63 |
"" |
| 64 |
+ "" |
| 65 |
+ "dimen activity_vertical\n" |
| 66 |
+ "id action_settings\n" |
| 67 |
+ "layout activity_main\n" |
| 68 |
); |
| 69 |
|
| 70 |
ResourceVisibilityLookup visibility = ResourceVisibilityLookup.create(library); |
| 71 |
assertTrue(visibility.isPrivate(ResourceType.DIMEN, "activity_horizontal_margin")); |
| 72 |
assertFalse(visibility.isPrivate(ResourceType.ID, "action_settings")); |
| 73 |
assertFalse(visibility.isPrivate(ResourceType.LAYOUT, "activity_main")); |
| 74 |
//noinspection ConstantConditions |
| 75 |
assertTrue(visibility.isPrivate(ResourceUrl.parse("@dimen/activity_horizontal_margin"))); |
| 76 |
|
| 77 |
assertFalse(visibility.isPrivate(ResourceType.DIMEN, "activity_vertical")); // public |
| 78 |
assertFalse(visibility.isPrivate(ResourceType.DIMEN, "unknown")); // not in this library |
| 79 |
} |
| 80 |
|
| 81 |
public void testModelVersions() throws IOException { |
| 82 |
AndroidLibrary library = createMockLibrary( |
| 83 |
"com.android.tools:test-library:1.0.0", |
| 84 |
"" |
| 85 |
+ "int dimen activity_horizontal_margin 0x7f030000\n" |
| 86 |
+ "int dimen activity_vertical_margin 0x7f030001\n" |
| 87 |
+ "int id action_settings 0x7f060000\n" |
| 88 |
+ "int layout activity_main 0x7f020000\n" |
| 89 |
+ "int menu menu_main 0x7f050000\n" |
| 90 |
+ "int string action_settings 0x7f040000\n" |
| 91 |
+ "int string app_name 0x7f040001\n" |
| 92 |
+ "int string hello_world 0x7f040002", |
| 93 |
"" |
| 94 |
+ "" |
| 95 |
+ "dimen activity_vertical\n" |
| 96 |
+ "id action_settings\n" |
| 97 |
+ "layout activity_main\n" |
| 98 |
); |
| 99 |
|
| 100 |
AndroidArtifact mockArtifact = createMockArtifact(Collections.singletonList(library)); |
| 101 |
Variant variant = createMockVariant(mockArtifact); |
| 102 |
|
| 103 |
AndroidProject project; |
| 104 |
|
| 105 |
project = createMockProject("1.0.1", 0); |
| 106 |
assertTrue(new ResourceVisibilityLookup.Provider().get(project, variant).isEmpty()); |
| 107 |
|
| 108 |
|
| 109 |
project = createMockProject("1.1", 0); |
| 110 |
assertTrue(new ResourceVisibilityLookup.Provider().get(project, variant).isEmpty()); |
| 111 |
|
| 112 |
project = createMockProject("1.2", 2); |
| 113 |
assertTrue(new ResourceVisibilityLookup.Provider().get(project, variant).isEmpty()); |
| 114 |
|
| 115 |
project = createMockProject("1.3.0", 3); |
| 116 |
assertFalse(new ResourceVisibilityLookup.Provider().get(project, variant).isEmpty()); |
| 117 |
|
| 118 |
project = createMockProject("2.5", 45); |
| 119 |
assertFalse(new ResourceVisibilityLookup.Provider().get(project, variant).isEmpty()); |
| 120 |
|
| 121 |
ResourceVisibilityLookup visibility =new ResourceVisibilityLookup.Provider().get(project, |
| 122 |
variant); |
| 123 |
assertTrue(visibility.isPrivate(ResourceType.DIMEN, "activity_horizontal_margin")); |
| 124 |
assertFalse(visibility.isPrivate(ResourceType.ID, "action_settings")); |
| 125 |
} |
| 126 |
|
| 127 |
public void testAllPrivate() throws IOException { |
| 128 |
AndroidLibrary library = createMockLibrary( |
| 129 |
"com.android.tools:test-library:1.0.0", |
| 130 |
"" |
| 131 |
+ "int dimen activity_horizontal_margin 0x7f030000\n" |
| 132 |
+ "int dimen activity_vertical_margin 0x7f030001\n" |
| 133 |
+ "int id action_settings 0x7f060000\n" |
| 134 |
+ "int layout activity_main 0x7f020000\n" |
| 135 |
+ "int menu menu_main 0x7f050000\n" |
| 136 |
+ "int string action_settings 0x7f040000\n" |
| 137 |
+ "int string app_name 0x7f040001\n" |
| 138 |
+ "int string hello_world 0x7f040002", |
| 139 |
"" |
| 140 |
); |
| 141 |
|
| 142 |
ResourceVisibilityLookup visibility = ResourceVisibilityLookup.create(library); |
| 143 |
assertTrue(visibility.isPrivate(ResourceType.DIMEN, "activity_horizontal_margin")); |
| 144 |
assertTrue(visibility.isPrivate(ResourceType.ID, "action_settings")); |
| 145 |
assertTrue(visibility.isPrivate(ResourceType.LAYOUT, "activity_main")); |
| 146 |
assertTrue(visibility.isPrivate(ResourceType.DIMEN, "activity_vertical_margin")); |
| 147 |
|
| 148 |
assertFalse(visibility.isPrivate(ResourceType.DIMEN, "unknown")); // not in this library |
| 149 |
} |
| 150 |
|
| 151 |
public void testNotDeclared() throws IOException { |
| 152 |
AndroidLibrary library = createMockLibrary("com.android.tools:test-library:1.0.0", "", |
| 153 |
null); |
| 154 |
|
| 155 |
ResourceVisibilityLookup visibility = ResourceVisibilityLookup.create(library); |
| 156 |
assertFalse(visibility.isPrivate(ResourceType.DIMEN, "activity_horizontal_margin")); |
| 157 |
assertFalse(visibility.isPrivate(ResourceType.ID, "action_settings")); |
| 158 |
assertFalse(visibility.isPrivate(ResourceType.LAYOUT, "activity_main")); |
| 159 |
assertFalse(visibility.isPrivate(ResourceType.DIMEN, "activity_vertical")); |
| 160 |
|
| 161 |
assertFalse(visibility.isPrivate(ResourceType.DIMEN, "unknown")); // not in this library |
| 162 |
} |
| 163 |
|
| 164 |
public void testCombined() throws IOException { |
| 165 |
AndroidLibrary library1 = createMockLibrary( |
| 166 |
"com.android.tools:test-library:1.0.0", |
| 167 |
"" |
| 168 |
+ "int dimen activity_horizontal_margin 0x7f030000\n" |
| 169 |
+ "int dimen activity_vertical_margin 0x7f030001\n" |
| 170 |
+ "int id action_settings 0x7f060000\n" |
| 171 |
+ "int layout activity_main 0x7f020000\n" |
| 172 |
+ "int menu menu_main 0x7f050000\n" |
| 173 |
+ "int string action_settings 0x7f040000\n" |
| 174 |
+ "int string app_name 0x7f040001\n" |
| 175 |
+ "int string hello_world 0x7f040002", |
| 176 |
"" |
| 177 |
); |
| 178 |
AndroidLibrary library2 = createMockLibrary( |
| 179 |
"com.android.tools:test-library2:1.0.0", |
| 180 |
"" |
| 181 |
+ "int layout foo 0x7f030001\n" |
| 182 |
+ "int layout bar 0x7f060000\n", |
| 183 |
"" |
| 184 |
+ "layout foo\n" |
| 185 |
); |
| 186 |
|
| 187 |
List<AndroidLibrary> androidLibraries = Arrays.asList(library1, library2); |
| 188 |
ResourceVisibilityLookup visibility = ResourceVisibilityLookup |
| 189 |
.create(androidLibraries, null); |
| 190 |
assertTrue(visibility.isPrivate(ResourceType.DIMEN, "activity_horizontal_margin")); |
| 191 |
assertTrue(visibility.isPrivate(ResourceType.ID, "action_settings")); |
| 192 |
assertTrue(visibility.isPrivate(ResourceType.LAYOUT, "activity_main")); |
| 193 |
assertTrue(visibility.isPrivate(ResourceType.DIMEN, "activity_vertical_margin")); |
| 194 |
assertFalse(visibility.isPrivate(ResourceType.LAYOUT, "foo")); |
| 195 |
assertTrue(visibility.isPrivate(ResourceType.LAYOUT, "bar")); |
| 196 |
|
| 197 |
assertFalse(visibility.isPrivate(ResourceType.DIMEN, "unknown")); // not in this library |
| 198 |
} |
| 199 |
|
| 200 |
public void testDependency() throws IOException { |
| 201 |
AndroidLibrary library1 = createMockLibrary( |
| 202 |
"com.android.tools:test-library:1.0.0", |
| 203 |
"" |
| 204 |
+ "int dimen activity_horizontal_margin 0x7f030000\n" |
| 205 |
+ "int dimen activity_vertical_margin 0x7f030001\n" |
| 206 |
+ "int id action_settings 0x7f060000\n" |
| 207 |
+ "int layout activity_main 0x7f020000\n" |
| 208 |
+ "int menu menu_main 0x7f050000\n" |
| 209 |
+ "int string action_settings 0x7f040000\n" |
| 210 |
+ "int string app_name 0x7f040001\n" |
| 211 |
+ "int string hello_world 0x7f040002", |
| 212 |
"" |
| 213 |
); |
| 214 |
AndroidLibrary library2 = createMockLibrary( |
| 215 |
"com.android.tools:test-library2:1.0.0", |
| 216 |
"" |
| 217 |
+ "int layout foo 0x7f030001\n" |
| 218 |
+ "int layout bar 0x7f060000\n", |
| 219 |
"" |
| 220 |
+ "layout foo\n", |
| 221 |
Collections.singletonList(library1) |
| 222 |
); |
| 223 |
|
| 224 |
List<AndroidLibrary> androidLibraries = Arrays.asList(library1, library2); |
| 225 |
ResourceVisibilityLookup visibility = ResourceVisibilityLookup |
| 226 |
.create(androidLibraries, null); |
| 227 |
assertTrue(visibility.isPrivate(ResourceType.DIMEN, "activity_horizontal_margin")); |
| 228 |
assertTrue(visibility.isPrivate(ResourceType.ID, "action_settings")); |
| 229 |
assertTrue(visibility.isPrivate(ResourceType.LAYOUT, "activity_main")); |
| 230 |
assertTrue(visibility.isPrivate(ResourceType.DIMEN, "activity_vertical_margin")); |
| 231 |
assertFalse(visibility.isPrivate(ResourceType.LAYOUT, "foo")); |
| 232 |
assertTrue(visibility.isPrivate(ResourceType.LAYOUT, "bar")); |
| 233 |
|
| 234 |
assertFalse(visibility.isPrivate(ResourceType.DIMEN, "unknown")); // not in this library |
| 235 |
} |
| 236 |
|
| 237 |
public void testManager() throws IOException { |
| 238 |
AndroidLibrary library = createMockLibrary( |
| 239 |
"com.android.tools:test-library:1.0.0", |
| 240 |
"" |
| 241 |
+ "int dimen activity_horizontal_margin 0x7f030000\n" |
| 242 |
+ "int dimen activity_vertical_margin 0x7f030001\n" |
| 243 |
+ "int id action_settings 0x7f060000\n" |
| 244 |
+ "int layout activity_main 0x7f020000\n" |
| 245 |
+ "int menu menu_main 0x7f050000\n" |
| 246 |
+ "int string action_settings 0x7f040000\n" |
| 247 |
+ "int string app_name 0x7f040001\n" |
| 248 |
+ "int string hello_world 0x7f040002", |
| 249 |
"" |
| 250 |
); |
| 251 |
ResourceVisibilityLookup.Provider provider = new ResourceVisibilityLookup.Provider(); |
| 252 |
assertSame(provider.get(library), provider.get(library)); |
| 253 |
assertTrue(provider.get(library).isPrivate(ResourceType.DIMEN, |
| 254 |
"activity_horizontal_margin")); |
| 255 |
|
| 256 |
AndroidArtifact artifact = createMockArtifact(Collections.singletonList(library)); |
| 257 |
assertSame(provider.get(artifact), provider.get(artifact)); |
| 258 |
assertTrue(provider.get(artifact).isPrivate(ResourceType.DIMEN, |
| 259 |
"activity_horizontal_margin")); |
| 260 |
} |
| 261 |
|
| 262 |
public void testImportedResources() throws IOException { |
| 263 |
// Regression test for https://code.google.com/p/android/issues/detail?id=183120 : |
| 264 |
// When a library depends on another library, all the resources from the dependency |
| 265 |
// are imported and exposed in R.txt from the downstream library too. When both |
| 266 |
// libraries expose public resources, we have to be careful such that we don't |
| 267 |
// take the presence of a resource (imported) and the absence of a public.txt declaration |
| 268 |
// (for the imported symbol in the dependent library) as evidence that this is a private |
| 269 |
// resource. |
| 270 |
AndroidLibrary library1 = createMockLibrary( |
| 271 |
"com.android.tools:test-library:1.0.0", |
| 272 |
"" |
| 273 |
+ "int dimen public_library1_resource1 0x7f030000\n" |
| 274 |
+ "int dimen public_library1_resource2 0x7f030001\n" |
| 275 |
+ "int dimen private_library1_resource 0x7f030002\n", |
| 276 |
"" |
| 277 |
+ "dimen public_library1_resource1\n" |
| 278 |
+ "dimen public_library1_resource2\n" |
| 279 |
); |
| 280 |
|
| 281 |
AndroidLibrary library2 = createMockLibrary( |
| 282 |
"com.android.tools:test-library2:1.0.0", |
| 283 |
"" |
| 284 |
+ "int dimen public_library2_resource1 0x7f030000\n" |
| 285 |
+ "int dimen public_library2_resource2 0x7f030001\n", |
| 286 |
null // nothing marked as private: everything exposed |
| 287 |
); |
| 288 |
AndroidLibrary library3 = createMockLibrary( |
| 289 |
"com.android.tools:test-library3:1.0.0", |
| 290 |
"" |
| 291 |
+ "int dimen public_library1_resource1 0x7f030000\n" // merged from library1 |
| 292 |
+ "int dimen public_library1_resource2 0x7f030001\n" |
| 293 |
+ "int dimen private_library1_resource 0x7f030002\n" |
| 294 |
+ "int dimen public_library2_resource1 0x7f030003\n" // merged from library2 |
| 295 |
+ "int dimen public_library2_resource2 0x7f030004\n" |
| 296 |
+ "int dimen public_library3_resource1 0x7f030005\n" // unique to library3 |
| 297 |
+ "int dimen private_library3_resource 0x7f030006\n", |
| 298 |
"" |
| 299 |
+ "dimen public_library2_resource1\n", |
| 300 |
Arrays.asList(library1, library2) |
| 301 |
); |
| 302 |
|
| 303 |
List<AndroidLibrary> androidLibraries = Arrays.asList(library1, library2, library3); |
| 304 |
ResourceVisibilityLookup visibility = ResourceVisibilityLookup.create(androidLibraries, |
| 305 |
null); |
| 306 |
assertTrue(visibility.isPrivate(ResourceType.DIMEN, "private_library1_resource")); |
| 307 |
assertTrue(visibility.isPrivate(ResourceType.DIMEN, "private_library3_resource")); |
| 308 |
assertFalse(visibility.isPrivate(ResourceType.DIMEN, "public_library1_resource1")); |
| 309 |
assertFalse(visibility.isPrivate(ResourceType.DIMEN, "public_library1_resource2")); |
| 310 |
assertFalse(visibility.isPrivate(ResourceType.DIMEN, "public_library2_resource1")); |
| 311 |
assertFalse(visibility.isPrivate(ResourceType.DIMEN, "public_library2_resource2")); |
| 312 |
assertFalse(visibility.isPrivate(ResourceType.DIMEN, "public_library3_resource")); |
| 313 |
} |
| 314 |
|
| 315 |
public void testSymbolProvider() throws Exception { |
| 316 |
AndroidLibrary library1 = createMockLibrary( |
| 317 |
"com.android.tools:test-library:1.0.0", |
| 318 |
"" |
| 319 |
+ "int dimen public_library1_resource1 0x7f030000\n" |
| 320 |
+ "int dimen public_library1_resource2 0x7f030001\n" |
| 321 |
+ "int dimen private_library1_resource 0x7f030002\n", |
| 322 |
"" |
| 323 |
+ "dimen public_library1_resource1\n" |
| 324 |
+ "dimen public_library1_resource2\n" |
| 325 |
); |
| 326 |
|
| 327 |
AndroidLibrary library3 = createMockLibrary( |
| 328 |
"com.android.tools:test-library3:1.0.0", |
| 329 |
"" |
| 330 |
+ "int dimen public_library1_resource1 0x7f030000\n" // merged from library1 |
| 331 |
+ "int dimen public_library1_resource2 0x7f030001\n" |
| 332 |
+ "int dimen private_library1_resource 0x7f030002\n" |
| 333 |
+ "int dimen public_library2_resource1 0x7f030003\n" // merged from library2 |
| 334 |
+ "int dimen public_library2_resource2 0x7f030004\n" |
| 335 |
+ "int dimen public_library3_resource1 0x7f030005\n" // unique to library3 |
| 336 |
+ "int dimen private_library3_resource 0x7f030006\n", |
| 337 |
"" |
| 338 |
+ "dimen public_library2_resource1\n", |
| 339 |
Collections.singletonList(library1) |
| 340 |
); |
| 341 |
|
| 342 |
SymbolProvider provider = new SymbolProvider(); |
| 343 |
Multimap<String, ResourceType> symbols = provider.getSymbols(library3); |
| 344 |
|
| 345 |
// Exclude imported symbols |
| 346 |
assertFalse(symbols.get("public_library1_resource1").iterator().hasNext()); |
| 347 |
|
| 348 |
// Make sure non-imported symbols are there |
| 349 |
assertSame(ResourceType.DIMEN, symbols.get("public_library3_resource1").iterator().next()); |
| 350 |
|
| 351 |
// Make sure we're actually caching results |
| 352 |
Multimap<String, ResourceType> symbols2 = provider.getSymbols(library3); |
| 353 |
assertSame(symbols, symbols2); |
| 354 |
} |
| 355 |
|
| 356 |
public static AndroidProject createMockProject(String modelVersion, int apiVersion) { |
| 357 |
AndroidProject project = createNiceMock(AndroidProject.class); |
| 358 |
expect(project.getApiVersion()).andReturn(apiVersion).anyTimes(); |
| 359 |
expect(project.getModelVersion()).andReturn(modelVersion).anyTimes(); |
| 360 |
replay(project); |
| 361 |
|
| 362 |
return project; |
| 363 |
} |
| 364 |
|
| 365 |
public static Variant createMockVariant(AndroidArtifact artifact) { |
| 366 |
Variant variant = createNiceMock(Variant.class); |
| 367 |
expect(variant.getMainArtifact()).andReturn(artifact).anyTimes(); |
| 368 |
replay(variant); |
| 369 |
return variant; |
| 370 |
|
| 371 |
} |
| 372 |
|
| 373 |
public static AndroidArtifact createMockArtifact(List<AndroidLibrary> libraries) { |
| 374 |
Dependencies dependencies = createNiceMock(Dependencies.class); |
| 375 |
expect(dependencies.getLibraries()).andReturn(libraries).anyTimes(); |
| 376 |
replay(dependencies); |
| 377 |
|
| 378 |
AndroidArtifact artifact = createNiceMock(AndroidArtifact.class); |
| 379 |
expect(artifact.getDependencies()).andReturn(dependencies).anyTimes(); |
| 380 |
replay(artifact); |
| 381 |
|
| 382 |
return artifact; |
| 383 |
} |
| 384 |
|
| 385 |
public static AndroidLibrary createMockLibrary(String name, String allResources, |
| 386 |
String publicResources) |
| 387 |
throws IOException { |
| 388 |
return createMockLibrary(name, allResources, publicResources, |
| 389 |
Collections.<AndroidLibrary>emptyList()); |
| 390 |
} |
| 391 |
|
| 392 |
|
| 393 |
public static AndroidLibrary createMockLibrary(String name, |
| 394 |
String allResources, String publicResources, |
| 395 |
List<AndroidLibrary> dependencies) |
| 396 |
throws IOException { |
| 397 |
// Identical to PrivateResourceDetectorTest, but these are in test modules that |
| 398 |
// can't access each other |
| 399 |
final File tempDir = TestUtils.createTempDirDeletedOnExit(); |
| 400 |
|
| 401 |
Files.write(allResources, new File(tempDir, FN_RESOURCE_TEXT), Charsets.UTF_8); |
| 402 |
File publicTxtFile = new File(tempDir, FN_PUBLIC_TXT); |
| 403 |
if (publicResources != null) { |
| 404 |
Files.write(publicResources, publicTxtFile, Charsets.UTF_8); |
| 405 |
} |
| 406 |
AndroidLibrary library = mock(AndroidLibrary.class); |
| 407 |
when(library.getPublicResources()).thenReturn(publicTxtFile); |
| 408 |
GradleCoordinate c = GradleCoordinate.parseCoordinateString(name); |
| 409 |
assertNotNull(c); |
| 410 |
MavenCoordinates coordinates = mock(MavenCoordinates.class); |
| 411 |
when(coordinates.getGroupId()).thenReturn(c.getGroupId()); |
| 412 |
when(coordinates.getArtifactId()).thenReturn(c.getArtifactId()); |
| 413 |
when(coordinates.getVersion()).thenReturn(c.getRevision()); |
| 414 |
when(library.getResolvedCoordinates()).thenReturn(coordinates); |
| 415 |
when(library.getBundle()).thenReturn(new File("intermediates" + File.separator + |
| 416 |
"exploded-aar" + File.separator + name)); |
| 417 |
|
| 418 |
// Work around wildcard capture |
| 419 |
//when(library.getLibraryDependencies()).thenReturn(dependencies); |
| 420 |
List libraryDependencies = library.getLibraryDependencies(); |
| 421 |
OngoingStubbing<List> setter = when(libraryDependencies); |
| 422 |
setter.thenReturn(dependencies); |
| 423 |
return library; |
| 424 |
} |
| 425 |
} |