    @Test
    public void testOnDownloadEnd() {

        final String torrentFile = "file";
        final int downloadState = 42;
        LocalBroadcaster localBroadcaster = new LocalBroadcaster(RuntimeEnvironment.application);
        localBroadcaster.onDownloadEnd(torrentFile, downloadState);
        LocalBroadcastManager localBroadcastManager = LocalBroadcastManager.getInstance(RuntimeEnvironment.application);
        ShadowLocalBroadcastManager shadowLocalBroadcastManager = Shadows.shadowOf(localBroadcastManager);
        List<Intent> broadcastIntents = shadowLocalBroadcastManager.getSentBroadcastIntents();
        assertThat(broadcastIntents.size()).isEqualTo(1);
        Intent referenceBroadcast =
                new DownloadEndBroadcast()
                        .setTorrentFile(torrentFile)
                        .setDownloadState(downloadState)
                        .createIntent();
        assertThat(broadcastIntents.get(0).equals(referenceBroadcast)).isTrue();
    }