Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package org.jenkinsci.plugins.badge.actions;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.IsNull.nullValue;

import hudson.model.Job;
import hudson.model.Run;
Comment thread
abhishekmaity marked this conversation as resolved.
Outdated
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
Comment thread
abhishekmaity marked this conversation as resolved.
Outdated

public class EmbeddableBadgeConfigsActionTest {

EmbeddableBadgeConfigsAction embeddableBadgeConfigsAction;

@BeforeEach
void setUp() {
Run mockRun = Mockito.mock(Run.class);
Job mockJob = Mockito.mock(Job.class);
Mockito.when(mockRun.getParent()).thenReturn(mockJob);
Comment thread
abhishekmaity marked this conversation as resolved.
Outdated
embeddableBadgeConfigsAction = new EmbeddableBadgeConfigsAction();
}

@Test
public void getUrlNameTest() {
assertThat(embeddableBadgeConfigsAction.getUrlName(), is(""));
}

@Test
public void getDisplayNameTest() {
assertThat(embeddableBadgeConfigsAction.getDisplayName(), is(""));
}

@Test
public void getIconFileNameTest() {
assertThat(embeddableBadgeConfigsAction.getIconFileName(), is(nullValue()));
}

@Test
public void resolveTest() {
Job mockRun = Mockito.mock(Job.class);
Mockito.when(mockRun.getParent()).thenReturn(null);
assertThat(mockRun.getLastBuild(), is(nullValue()));
}

@Test
public void getConfigTest() {
Run mockRun = Mockito.mock(Run.class);
Mockito.when(mockRun.getParent()).thenReturn(null);
assertThat(mockRun.getId(), is(nullValue()));
}
Comment thread
abhishekmaity marked this conversation as resolved.
Outdated
}