Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

Commit

Permalink
Enable checkstyle for integration-tests
Browse files Browse the repository at this point in the history
Signed-off-by: Moti Asayag <masayag@redhat.com>
  • Loading branch information
masayag authored and openshift-merge-robot committed May 22, 2023
1 parent 2158e99 commit dc3a601
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
4 changes: 4 additions & 0 deletions integration-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
</plugin>
</plugins>
</build>
<profiles>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
import java.util.List;
import java.util.UUID;

import com.redhat.parodos.notification.sdk.api.*;
import com.redhat.parodos.notification.sdk.api.ApiClient;
import com.redhat.parodos.notification.sdk.api.ApiException;
import com.redhat.parodos.notification.sdk.api.Configuration;
import com.redhat.parodos.notification.sdk.api.NotificationMessageApi;
import com.redhat.parodos.notification.sdk.api.NotificationRecordApi;
import com.redhat.parodos.notification.sdk.model.NotificationMessageCreateRequestDTO;
import com.redhat.parodos.notification.sdk.model.NotificationRecordResponseDTO;
import com.redhat.parodos.notification.sdk.model.PageNotificationRecordResponseDTO;
Expand All @@ -18,6 +22,7 @@
import org.springframework.http.HttpHeaders;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertThrows;

Expand Down Expand Up @@ -59,12 +64,14 @@ public void notificationServiceHappyFlow() {

countNotificationRecord(testName);
PageNotificationRecordResponseDTO notificationsAfterCreation = listNotificationRecord(testName, null);
assertNotNull(notificationsAfterCreation.getContent());
NotificationRecordResponseDTO notificationRecord1 = notificationsAfterCreation.getContent().get(0);
logTestStep(testName, "Update one Notification Record as \"READ\"");
updateNotificationRecord(testName, notificationRecord1.getId(), "READ");

countNotificationRecord(testName);
PageNotificationRecordResponseDTO notificationsAfterUpdate = listNotificationRecord(testName, null);
assertNotNull(notificationsAfterUpdate.getContent());
NotificationRecordResponseDTO notificationRecord2 = notificationsAfterUpdate.getContent().get(1);
deleteNotificationRecord(testName, notificationRecord2.getId());

Expand All @@ -88,7 +95,7 @@ public void notificationServiceListInvalidSortErr() {
String testName = "notificationServiceListInvalidSortErr";

ApiException e = assertThrows(ApiException.class, () -> {
listNotificationRecord(testName, Arrays.asList(user));
listNotificationRecord(testName, List.of(user));
});
assertEquals(400, e.getCode());
}
Expand All @@ -109,7 +116,7 @@ public void notificationServiceCreateEmptyUsernames() {
String testName = "notificationServiceCreateMissingUsernames";

ApiException e = assertThrows(ApiException.class, () -> {
createNotificationMessage(testName, "type0", "body0", "subject0", new ArrayList());
createNotificationMessage(testName, "type0", "body0", "subject0", new ArrayList<>());
});
assertEquals(400, e.getCode());
}
Expand Down Expand Up @@ -217,7 +224,7 @@ private void logTestStep(String testName, String stepDescription) {
private void countNotificationRecord(String testName) throws ApiException {
logTestStep(testName, "Count Notification Records for the user");
Integer count = this.recordApiInstance.countUnreadNotifications("UNREAD");
log.info("Found ", count, "notification records for the user");
log.info("Found {} notification records for the user", count);
assertEquals(countNotificationsExpectedCount, count.intValue());
}

Expand All @@ -226,6 +233,7 @@ private PageNotificationRecordResponseDTO listNotificationRecord(String testName
logTestStep(testName, "List Notification Records for the user");
PageNotificationRecordResponseDTO result = this.recordApiInstance.getNotifications(0, 10, sort, null, null);
List<NotificationRecordResponseDTO> content = result.getContent();
assertNotNull(content);
log.info(content.toString());
assertEquals(listNotificationsExpectedCount, content.size());
return result;
Expand Down

0 comments on commit dc3a601

Please sign in to comment.