Skip to content

Commit 3155a31

Browse files
committed
Added test for invalid branch of reject method
1 parent e4ccd4d commit 3155a31

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/test/java/edu/tamu/app/controller/FeatureProposalControllerTest.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
package edu.tamu.app.controller;
22

3+
import static edu.tamu.weaver.response.ApiStatus.INVALID;
34
import static edu.tamu.weaver.response.ApiStatus.SUCCESS;
45
import static org.junit.Assert.assertEquals;
6+
import static org.junit.Assert.assertNotEquals;
57
import static org.mockito.Matchers.any;
68
import static org.mockito.Mockito.doNothing;
79
import static org.mockito.Mockito.when;
@@ -102,7 +104,7 @@ public void setup() throws UserNotFoundException {
102104
when(featureProposalRepo.create(any(FeatureProposal.class), any(Credentials.class))).thenReturn(TEST_FEATURE_PROPOSAL1);
103105
when(featureProposalRepo.create(any(Idea.class))).thenReturn(TEST_FEATURE_PROPOSAL1);
104106
when(featureProposalRepo.update(any(FeatureProposal.class))).thenReturn(TEST_MODIFIED_FEATURE_PROPOSAL);
105-
when(featureProposalRepo.reject(TEST_FEATURE_PROPOSAL1)).thenReturn(rejectedFeatureProposal);
107+
when(featureProposalRepo.reject(featureProposalWithFeedback)).thenReturn(rejectedFeatureProposal);
106108
when(serviceRepo.findOne(any(Long.class))).thenReturn(TEST_SERVICE);
107109
doNothing().when(featureProposalRepo).delete(any(FeatureProposal.class));
108110
doNothing().when(featureProposalRepo).delete(any(FeatureProposal.class));
@@ -156,6 +158,12 @@ public void testReject() {
156158
FeatureProposal featureProposal = (FeatureProposal) response.getPayload().get("FeatureProposal");
157159
assertEquals("State was not set to Rejected", rejectedFeatureProposal.getState(), featureProposal.getState());
158160
}
161+
162+
@Test
163+
public void testInvalidReject() {
164+
response = featureProposalController.reject(TEST_FEATURE_PROPOSAL1);
165+
assertEquals("Ffeature proposal without feedback was not rejected", INVALID, response.getMeta().getStatus());
166+
}
159167

160168
@Test
161169
public void testRemove() {

0 commit comments

Comments
 (0)