View sourceView = mock(View.class);
when(transferable.getTransferData(eq(GOOD_FLAVOR))).thenReturn(new View[]{sourceView});
// Mock persistence provider, policy manager, and platform.
PlatformAccess access = new PlatformAccess();
Platform mockPlatform = Mockito.mock(Platform.class);
PersistenceProvider mockPersistenceProvider = Mockito.mock(PersistenceProvider.class);
PolicyManager mockpoPolicyManager = Mockito.mock(PolicyManager.class);
CoreComponentRegistry mockComponentRegistry = Mockito.mock(CoreComponentRegistry.class);
WindowManager mockWindowManager = Mockito.mock(WindowManager.class);
access.setPlatform(mockPlatform);
Mockito.when(mockPlatform.getPersistenceProvider()).thenReturn(mockPersistenceProvider);
Mockito.when(mockPlatform.getPolicyManager()).thenReturn(mockPolicyManager);
ExecutionResult mockResult = new ExecutionResult(new PolicyContext(), true, "");
Mockito.when(mockpoPolicyManager.execute(Mockito.anyString(), Mockito.any(PolicyContext.class))).thenReturn(mockResult);
Mockito.when(mockPlatform.getComponentRegistry()).thenReturn(mockComponentRegistry);