Skip to content
Snippets Groups Projects

feat: Add id path endpoint + tests

4 unresolved threads
Edited by Zachary Sabourin

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
76 78 public List<CveData> getAllCves() {
77 79 return new ArrayList<>(this.internal);
78 80 }
79
81
82 @Override
83 public CveData getCve(String id) {
84 List<CveData> matchingCves = internal.stream().filter(cve -> cve.getId().equalsIgnoreCase(id)).collect(Collectors.toList());
  • 15 public final static String CVE_BASE_URL = CVES_BASE_URL + "/{id}";
    16
    17 public final static String VALID_CVE_ID = "cve-2020-27225";
    18 public final static String INVALID_CVE_ID = "jim-bob-2022";
    19
    20 @Test
    21 void getAll_success() {
    22 given()
    23 .when()
    24 .get(CVES_BASE_URL)
    25 .then()
    26 .statusCode(200);
    27 }
    28
    29 @Test
    30 void getAll_success_validRequestFormat() {
  • Martin Lowe
  • 46 .statusCode(200);
    47 }
    48
    49 @Test
    50 void getAll_success_matchingSpec() {
    51 given()
    52 .when()
    53 .get(CVES_BASE_URL)
    54 .then()
    55 .assertThat()
    56 .body(matchesJsonSchemaInClasspath(SchemaNamespaceHelper.CVES_SCHEMA_PATH));
    57 }
    58
    59 @Test
    60 void getAll_failure_invalidFormat() {
    61 given()
  • added 1 commit

    Compare with previous version

  • 64 .get(CVES_BASE_URL)
    65 .then()
    66 .statusCode(500);
    67 }
    68
    69 @Test
    70 void getById_success() {
    71 given()
    72 .when()
    73 .get(CVE_BASE_URL, VALID_CVE_ID)
    74 .then()
    75 .statusCode(200);
    76 }
    77
    78 @Test
    79 void getById_success_validRequestFormat() {
  • added 1 commit

    Compare with previous version

  • Martin Lowe approved this merge request

    approved this merge request

  • merged

  • Martin Lowe mentioned in commit 690621e7

    mentioned in commit 690621e7

  • Please register or sign in to reply
    Loading