Skip to content

Instantly share code, notes, and snippets.

@mferoc
Created May 18, 2024 14:29
Show Gist options
  • Save mferoc/fb8046c9a09d9e92f1932b207b02a59c to your computer and use it in GitHub Desktop.
Save mferoc/fb8046c9a09d9e92f1932b207b02a59c to your computer and use it in GitHub Desktop.
atividade-pos-ufscar-test-event.event
package de.danoeh.antennapod.event;
import org.junit.Assert;
import org.junit.Test;
import java.util.List;
import de.danoeh.antennapod.model.feed.Feed;
public class FeedListUpdateEventTest {
private final Feed feed = new Feed();
@Test
public void test_FeedListUpdateEvent_contains_sucesso() {
FeedListUpdateEvent feedListUpdateEvent = new FeedListUpdateEvent(feed);
Assert.assertTrue(feedListUpdateEvent.contains(feed));
}
@Test
public void test_FeedListUpdateEvent_byId_contains_sucesso() {
long feedId = feed.getId();
FeedListUpdateEvent feedListUpdateEvent = new FeedListUpdateEvent(feedId);
Assert.assertTrue(feedListUpdateEvent.contains(feed));
}
@Test
public void test_FeedListUpdateEvent_byFeedList_contains_sucesso() {
var feedList = List.of(feed);
FeedListUpdateEvent feedListUpdateEvent = new FeedListUpdateEvent(feedList);
Assert.assertTrue(feedListUpdateEvent.contains(feed));
}
}
package de.danoeh.antennapod.event;
import org.junit.Assert;
import org.junit.Test;
public class FeedUpdateRunningEventTest {
@Test
public void test_FeedUpdateRunningEvent_constructor() {
boolean isRunning = true;
FeedUpdateRunningEvent feedUpdateRunningEvent = new FeedUpdateRunningEvent(isRunning);
Assert.assertTrue(feedUpdateRunningEvent.isFeedUpdateRunning);
}
}
package de.danoeh.antennapod.event;
import android.content.Context;
import androidx.core.util.Consumer;
import org.junit.Assert;
import org.junit.Test;
public class MessageEventTest {
private final Consumer<Context> contextConsumer = Object::notify;
private final String message = "fake-test-message";
@Test
public void test_MessageEvent_byMessage_deveRetornarSucesso() {
MessageEvent messageEvent = new MessageEvent(this.message);
Assert.assertEquals(this.message, messageEvent.message);
}
@Test
public void test_MessageEvent_byAllAtributes_deveRetornarSucesso() {
String actionText = "fake-test-action-message";
MessageEvent messageEvent = new MessageEvent(
this.message,
contextConsumer,
actionText
);
Assert.assertEquals(this.message, messageEvent.message);
Assert.assertEquals(this.contextConsumer, messageEvent.action);
Assert.assertEquals(actionText, messageEvent.actionText);
}
}
package de.danoeh.antennapod.event;
import org.junit.Assert;
import org.junit.Test;
public class PlayerErrorEventTest {
@Test
public void test_PlayerErrorEvent_deve_retornar_sucesso() {
var message = "fake-test-message";
PlayerErrorEvent playerErrorEvent = new PlayerErrorEvent(message);
Assert.assertEquals(message, playerErrorEvent.getMessage());
}
}
package de.danoeh.antennapod.event;
import org.junit.Assert;
import org.junit.Test;
public class PlayerStatusEventTest {
@Test
public void test_PlayerStatusEvent_deve_ser_instanciado_com_sucesso() {
PlayerStatusEvent playerStatusEvent = new PlayerStatusEvent();
Assert.assertNotNull(playerStatusEvent);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment