Repository navigation
fix: reject mentee registration with missing applications - #820
Open
cosmiinn75 wants to merge 1 commit into
Open
cosmiinn75 wants to merge 1 commit into
cosmiinn75 wants to merge 1 commit into
Conversation
|
goelsonali
requested changes
Oct 17, 2026
| .header(API_KEY_HEADER, API_KEY_VALUE) | ||
| .contentType(APPLICATION_JSON) | ||
| .content( | ||
| "{\"mentee\":{\"id\":2,\"fullName\":\"Mark\",\"email\":\"mark@test.com\",\"position\":\"Software Engineer\",\"slackDisplayName\":\"mark-slack\",\"country\":{\"countryCode\":\"US\",\"countryName\":\"USA\"},\"city\":\"New York\",\"companyName\":\"Tech Corp\",\"images\":[],\"network\":[],\"profileStatus\":\"ACTIVE\",\"bio\":\"Mentee bio\",\"skills\":{\"yearsExperience\":2,\"areas\":[{\"technicalArea\":\"BACKEND\",\"proficiencyLevel\":\"BEGINNER\"}],\"languages\":[{\"language\":\"JAVASCRIPT\",\"proficiencyLevel\":\"BEGINNER\"}],\"mentorshipFocus\":[\"GROW_BEGINNER_TO_MID\"]}},\"mentorshipType\":\"AD_HOC\",\"cycleYear\":\"" |
Contributor
There was a problem hiding this comment.
Can we avoid, raw json content in file, yes it has been used before in previous tests but that is incorrect, would be good to clean-up that as well.
Why - Makes it harder to read the test data.
Suggested change
| "{\"mentee\":{\"id\":2,\"fullName\":\"Mark\",\"email\":\"mark@test.com\",\"position\":\"Software Engineer\",\"slackDisplayName\":\"mark-slack\",\"country\":{\"countryCode\":\"US\",\"countryName\":\"USA\"},\"city\":\"New York\",\"companyName\":\"Tech Corp\",\"images\":[],\"network\":[],\"profileStatus\":\"ACTIVE\",\"bio\":\"Mentee bio\",\"skills\":{\"yearsExperience\":2,\"areas\":[{\"technicalArea\":\"BACKEND\",\"proficiencyLevel\":\"BEGINNER\"}],\"languages\":[{\"language\":\"JAVASCRIPT\",\"proficiencyLevel\":\"BEGINNER\"}],\"mentorshipFocus\":[\"GROW_BEGINNER_TO_MID\"]}},\"mentorshipType\":\"AD_HOC\",\"cycleYear\":\"" | |
| @Test | |
| @DisplayName( | |
| "Given null applications in registration, when creating mentee, then return 400 Bad Request") | |
| void shouldReturn400WhenApplicationsIsNull() throws Exception { | |
| var mockMentee = createMenteeTest(2L, "Mark", "mark@test.com"); | |
| var registration = | |
| new MenteeRegistration(mockMentee, MentorshipType.AD_HOC, Year.now(), null); | |
| mockMvc | |
| .perform( | |
| MockMvcRequestBuilders.post(API_MENTEES) | |
| .header(API_KEY_HEADER, API_KEY_VALUE) | |
| .contentType(APPLICATION_JSON) | |
| .content(objectMapper.writeValueAsString(registration))) | |
| .andExpect(status().isBadRequest()); | |
| } | |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
@NotNullto theapplicationsfield inMenteeRegistration.Related Issue
Fixes #740
Change Type
Screenshots
Not applicable.
Pull request checklist