Skip to content

Commit e1b9c55

Browse files
committed
Added required service validation and fixed test
1 parent 3216b25 commit e1b9c55

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

src/main/java/edu/tamu/app/model/validation/IdeaValidator.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ public class IdeaValidator extends BaseModelValidator {
99
public IdeaValidator() {
1010
String titleProperty = "title";
1111
this.addInputValidator(new InputValidator(InputValidationType.required, "Ideas require a title", titleProperty, true));
12+
13+
String serviceProperty = "service";
14+
this.addInputValidator(new InputValidator(InputValidationType.required, "Ideas require a Service", serviceProperty, true));
1215
}
1316

1417
}

src/test/java/edu/tamu/app/model/FeatureProposalTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,14 +146,16 @@ public void testElevateIdea() throws UserNotFoundException {
146146
assertEquals("The number of FeatureProposals did not increase by one", initialCount + 1, featureProposalRepo.count());
147147
}
148148

149-
@Test(expected = InvalidDataAccessApiUsageException.class)
149+
@Test
150150
public void testDuplicateIdea() throws UserNotFoundException {
151151
long initialCount = featureProposalRepo.count();
152152
Idea testIdea = ideaRepo.create(new Idea(TEST_ALTERNATIVE_FEATURE_PROPOSAL_TITLE, TEST_ALTERNATIVE_FEATURE_PROPOSAL_DESCRIPTION, testUser, service1), TEST_CREDENTIALS);
153153
FeatureProposal featureProposal = featureProposalRepo.create(testIdea);
154154
assertEquals("The number of FeatureProposals did not increase by one", initialCount + 1, featureProposalRepo.count());
155+
long ideaCount = featureProposal.getIdeas().size();
155156
featureProposal.addIdea(testIdea);
156157
featureProposalRepo.save(featureProposal);
158+
assertEquals("The number of Ideas on the FeatureProposal did not increase", ideaCount, featureProposal.getIdeas().size());
157159
}
158160

159161
@Test(expected = DataIntegrityViolationException.class)

0 commit comments

Comments
 (0)