{"id":28527309,"url":"https://github.com/balamirr/safetynet","last_synced_at":"2025-10-20T08:02:23.490Z","repository":{"id":295616726,"uuid":"990659093","full_name":"BalamiRR/SafetyNet","owner":"BalamiRR","description":"Java, Spring Boot, JUnit, Integration Test, Unit Test, Jacoco Report, Surefire Report","archived":false,"fork":false,"pushed_at":"2025-07-16T10:20:40.000Z","size":138,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-17T13:36:35.896Z","etag":null,"topics":["integration-testing","jacoco","java","junit","spring-boot","surefire","unit-testing"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BalamiRR.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-26T12:46:30.000Z","updated_at":"2025-07-16T10:22:43.000Z","dependencies_parsed_at":"2025-07-16T17:54:57.526Z","dependency_job_id":"15d9d5d0-9729-441e-b813-8e9da90c3272","html_url":"https://github.com/BalamiRR/SafetyNet","commit_stats":null,"previous_names":["balamirr/safetynet"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/BalamiRR/SafetyNet","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BalamiRR%2FSafetyNet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BalamiRR%2FSafetyNet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BalamiRR%2FSafetyNet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BalamiRR%2FSafetyNet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BalamiRR","download_url":"https://codeload.github.com/BalamiRR/SafetyNet/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BalamiRR%2FSafetyNet/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279008630,"owners_count":26084480,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-11T02:00:06.511Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["integration-testing","jacoco","java","junit","spring-boot","surefire","unit-testing"],"created_at":"2025-06-09T12:12:28.642Z","updated_at":"2025-10-11T20:45:25.102Z","avatar_url":"https://github.com/BalamiRR.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"## SafetyNet\nSafetyNet Alerts is an application that helps emergency services, such as firefighters, respond quickly in case of an emergency.\nIt allows them to:\n * Know where people live in a city or region\n * Identify individuals at risk at a specific address\n * Find out which fire station is responsible for a given address\n\n\u003cimg width=\"250\" height=\"250\" alt=\"17159021463335_P5-01_SafetyNet\" src=\"https://github.com/user-attachments/assets/cac14442-e285-4037-932e-c609d8051ecc\" /\u003e\n\n### How does it work?\nSafetyNet Alerts uses a JSON file that contains:\n* The names and addresses of residents\n* Important medical information (such as medications)\n* The mapping between addresses and fire stations\nWhen a user or service makes a request (API call), the application reads the JSON file and responds with the appropriate information in JSON format.\n\n### Unit Tests\nThis project includes unit tests to verify the behaviour of service classes in isolation.\nFor example, in PersonServiceTest, we mock the PersonRepository and check that the service correctly delegates the CRUD operations.\n* Mocking with Mockito is used to isolate dependencies.\n* Examples tested:\n  * Saving a person: savePersonDelegatesToRepository()\n  *\n    ```\n    @Test\n    void savePersonDelegatesToRepository(){\n        Person p = new Person(\"Cristiano\", \"Ronaldo\", \"1509 Culver St\",\n                \"Culver\", \"97451\", \"841-874-651\", \"drk@email.com\");\n        when(personRepository.savePerson(p)).thenReturn(true);\n        assertTrue(personService.savePerson(p));\n        verify(personRepository).savePerson(p);\n    }\n    ```\n  * Updating and deleting person data.\n  * Ensures that business logic behaves correctly without relying on external components.\n\n###  Integration Tests\nIntegration tests verify the complete flow between the controller, service, and repository layers.\n  * Performed using MockMvc to simulate real HTTP requests.\n  * Examples tested:\n    * Creating a person via a POST request to /person.\n    * Retrieving data with endpoints like /childAlert, /phoneAlert, or /flood/stations.\n* These tests confirm that:\n  * JSON payloads are correctly handled.\n  * HTTP responses have expected status codes and content.\n  * The data flow from the controller to the repository is functional.\n   ```\n    @Test\n    public void createAPersonShouldReturnTrue() throws Exception {\n        Person person = new Person(\"Thomas\", \"Anderson\", \"15 Street John Kennedy\",\n                \"New York\", \"28000\", \"11-555-9999\", \"t.anderson@gmail.com\");\n        MockHttpServletResponse response = mockMvc.perform(MockMvcRequestBuilders\n                        .post(\"/person\")\n                        .content(objectMapper.writeValueAsString(person))\n                        .contentType(MediaType.APPLICATION_JSON)\n                        .accept(MediaType.APPLICATION_JSON))\n                .andExpect(status().isCreated())\n                .andReturn()\n                .getResponse();\n        assertEquals(\"true\", response.getContentAsString(StandardCharsets.UTF_8));\n    }\n  ```\n### JaCoCo Report\n\u003cimg width=\"560\" height=\"131\" alt=\"JaCoCo\" src=\"https://github.com/user-attachments/assets/bd2b26ee-ee82-4b11-b341-02c7f15c2df6\" /\u003e\n\n### Surefire Report\n\u003cimg width=\"852\" height=\"160\" alt=\"Surefire report\" src=\"https://github.com/user-attachments/assets/a8b72881-cc92-42aa-bce0-b0e9c0b01eed\" /\u003e\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbalamirr%2Fsafetynet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbalamirr%2Fsafetynet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbalamirr%2Fsafetynet/lists"}