Skip to content
This repository has been archived by the owner on Aug 13, 2020. It is now read-only.

Commit

Permalink
Add unit test for ComponentDestinationTest.java
Browse files Browse the repository at this point in the history
  • Loading branch information
Zeeshan Ghalib committed Feb 29, 2016
1 parent 0e83ba3 commit 19e04fc
Showing 1 changed file with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package uk.gov.justice.services.core.sender;

import org.junit.Before;
import org.junit.Test;
import uk.gov.justice.services.core.annotation.Component;

import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.assertThat;

public class ComponentDestinationTest {

private ComponentDestination componentDestination;

@Before
public void setup() {
componentDestination = new ComponentDestination();
}

@Test
public void shouldReturnCommandController() throws Exception {
assertThat(componentDestination.getDefault(Component.COMMAND_API), equalTo(Component.COMMAND_CONTROLLER));
}

@Test
public void shouldReturnCommandHandler() throws Exception {
assertThat(componentDestination.getDefault(Component.COMMAND_CONTROLLER), equalTo(Component.COMMAND_HANDLER));
}

@Test(expected = IllegalArgumentException.class)
public void shouldThrowExceptionOnComponentWithNoDefaultDestination() throws Exception {
componentDestination.getDefault(Component.COMMAND_HANDLER);
}
}

0 comments on commit 19e04fc

Please sign in to comment.