Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#1012 - Resolve Sonar report: missing assertions in several AppTest c… #1784

Merged
merged 1 commit into from
Jun 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion filterer/src/test/java/com/iluwatar/filterer/AppTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,14 @@

package com.iluwatar.filterer;

import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;

import org.junit.jupiter.api.Test;

class AppTest {

@Test
void shouldLaunchApp() {
App.main(new String[]{});
assertDoesNotThrow(() -> App.main(new String[]{}));
}
}
9 changes: 6 additions & 3 deletions monad/src/test/java/com/iluwatar/monad/AppTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,19 @@

package com.iluwatar.monad;

import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;

import org.junit.jupiter.api.Test;

/**
* Application Test
*/
public class AppTest {

class AppTest {

@Test
void testMain() {
App.main(new String[]{});
void shouldExecuteApplicationWithoutException() {
assertDoesNotThrow(() -> App.main(new String[]{}));
}

}
9 changes: 6 additions & 3 deletions monostate/src/test/java/com/iluwatar/monostate/AppTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,19 @@

package com.iluwatar.monostate;

import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;

import org.junit.jupiter.api.Test;

/**
* Application Test Entry
*/
public class AppTest {

class AppTest {

@Test
void testMain() {
App.main(new String[]{});
void shouldExecuteApplicationWithoutException() {
assertDoesNotThrow(() -> App.main(new String[]{}));
}

}
11 changes: 7 additions & 4 deletions multiton/src/test/java/com/iluwatar/multiton/AppTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,18 @@

package com.iluwatar.multiton;

import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;

import org.junit.jupiter.api.Test;

/**
* Application test
* Test if the application starts without throwing an exception.
*/
public class AppTest {

class AppTest {

@Test
void test() {
App.main(new String[]{});
void shouldExecuteApplicationWithoutException() {
assertDoesNotThrow(() -> App.main(new String[]{}));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@

package com.iluwatar.object.pool;

import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;

import org.junit.jupiter.api.Test;

/**
Expand All @@ -34,6 +36,6 @@ class AppTest {

@Test
void shouldExecuteApplicationWithoutException() {
App.main(new String[]{});
assertDoesNotThrow(() -> App.main(new String[]{}));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,16 @@

package com.iluwatar.parameter.object;

import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;

import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* Application test
*/
class AppTest {
private static final Logger LOGGER = LoggerFactory.getLogger(AppTest.class);

@Test
void shouldExecuteApplicationWithoutException() {
App.main(new String[]{});
LOGGER.info("Executed successfully without exception.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reasons for removing logging? Was it showing any issues on sonar?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The purpose of the logging was to assert that the code executed without errors. Since there is an aproprieted assertion for that, there is no need for this logging.

assertDoesNotThrow(() -> App.main(new String[]{}));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,17 @@

package com.iluwatar.saga.orchestration;

import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;

import org.junit.jupiter.api.Test;

/**
* empty test
* Test if the application starts without throwing an exception.
*/
class SagaApplicationTest {

@Test
void mainTest() {
SagaApplication.main(new String[]{});
void shouldExecuteApplicationWithoutException() {
assertDoesNotThrow(() -> SagaApplication.main(new String[]{}));
}
}