diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 14273eb..83e6209 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -4,6 +4,7 @@ on: push: branches: - master + - package # do not validate pull requests because SONAR_TOKEN is available only for project owner jobs: @@ -21,7 +22,7 @@ jobs: distribution: adopt - name: Build with Maven - run: mvn --batch-mode package sonar:sonar -Dsonar.projectKey=damianszczepanik_silencio -Dsonar.organization=damianszczepanik -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=$SONAR_TOKEN + run: mvn --batch-mode package sonar:sonar -Dsonar.projectKey=damianszczepanik_silencio -Dsonar.organization=damianszczepanik -Dsonar.host.url=https://sonarcloud.io -Dsonar.token=$SONAR_TOKEN env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/src/test/java/pl/szczepanik/silencio/utils/IOUtilityTest.java b/src/test/java/pl/szczepanik/silencio/utils/IOUtilityTest.java index a43bb35..b5ff8f4 100644 --- a/src/test/java/pl/szczepanik/silencio/utils/IOUtilityTest.java +++ b/src/test/java/pl/szczepanik/silencio/utils/IOUtilityTest.java @@ -56,12 +56,15 @@ void shouldFailOnIOException() throws Exception { String errorMessage = "Something is wrong!"; + // given + URL url = new URL(URL_ADDRESS); + // when - when(IOUtils.toString(new URL(URL_ADDRESS), StandardCharsets.UTF_8)) + when(IOUtils.toString(url, StandardCharsets.UTF_8)) .thenThrow(new IOException(errorMessage)); // then - assertThatThrownBy(() -> IOUtility.urlToString(new URL(URL_ADDRESS))) + assertThatThrownBy(() -> IOUtility.urlToString(url)) .isInstanceOf(IntegrityException.class) .hasMessage(errorMessage); }