Skip to content

Commit

Permalink
[FIX] test code and validate logic
Browse files Browse the repository at this point in the history
  • Loading branch information
jhhong0509 committed May 26, 2021
1 parent de4968d commit 6020b1d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,14 @@
@Component
public class GithubUrlValidator implements ConstraintValidator<ValidateGithubUrl, String> {

private static final String HTTP_GITHUB_LINK = "http://github.com";
private static final String HTTPS_GITHUB_LINK = "https://github.com";
private static final String GITHUB_LINK = "github.com";

@Override
public boolean isValid(String url, ConstraintValidatorContext context) {
return url == null || isStartsWithGithub(url);
}

private boolean isStartsWithGithub(String url) {
return url.startsWith(HTTP_GITHUB_LINK)
|| url.startsWith(HTTPS_GITHUB_LINK);
return url.contains(GITHUB_LINK);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ private SoleReportRequest buildSoleRequest(String title) {
.languages(Arrays.asList("sdf","asdfsa"))
.isSubmitted(true)
.grade(Grade.GRADE1)
.github("sf")
.github("github.com")
.field(Field.WEB)
.description("description")
.access(Access.EVERY)
Expand All @@ -205,7 +205,7 @@ private TeamReportRequest buildTeamRequest(String title) {
.languages(Arrays.asList("sdf","asdfsa"))
.isSubmitted(true)
.grade(Grade.GRADE1)
.github("sf")
.github("github.com")
.field(Field.WEB)
.description("description")
.access(Access.EVERY)
Expand Down

0 comments on commit 6020b1d

Please sign in to comment.