|
1 | 1 | package edu.tamu.app.controller; |
2 | 2 |
|
| 3 | +import static edu.tamu.weaver.response.ApiStatus.INVALID; |
3 | 4 | import static edu.tamu.weaver.response.ApiStatus.SUCCESS; |
4 | 5 | import static org.junit.Assert.assertEquals; |
| 6 | +import static org.junit.Assert.assertNotEquals; |
5 | 7 | import static org.mockito.Matchers.any; |
6 | 8 | import static org.mockito.Mockito.doNothing; |
7 | 9 | import static org.mockito.Mockito.when; |
@@ -102,7 +104,7 @@ public void setup() throws UserNotFoundException { |
102 | 104 | when(featureProposalRepo.create(any(FeatureProposal.class), any(Credentials.class))).thenReturn(TEST_FEATURE_PROPOSAL1); |
103 | 105 | when(featureProposalRepo.create(any(Idea.class))).thenReturn(TEST_FEATURE_PROPOSAL1); |
104 | 106 | 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); |
106 | 108 | when(serviceRepo.findOne(any(Long.class))).thenReturn(TEST_SERVICE); |
107 | 109 | doNothing().when(featureProposalRepo).delete(any(FeatureProposal.class)); |
108 | 110 | doNothing().when(featureProposalRepo).delete(any(FeatureProposal.class)); |
@@ -156,6 +158,12 @@ public void testReject() { |
156 | 158 | FeatureProposal featureProposal = (FeatureProposal) response.getPayload().get("FeatureProposal"); |
157 | 159 | assertEquals("State was not set to Rejected", rejectedFeatureProposal.getState(), featureProposal.getState()); |
158 | 160 | } |
| 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 | + } |
159 | 167 |
|
160 | 168 | @Test |
161 | 169 | public void testRemove() { |
|
0 commit comments