Skip to content

Commit

Permalink
Fix typos in unit tests (#883)
Browse files Browse the repository at this point in the history
  • Loading branch information
loicgreffier authored Aug 5, 2024
1 parent c3c58af commit c69452e
Show file tree
Hide file tree
Showing 11 changed files with 59 additions and 69 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import org.assertj.core.api.Assertions;
import org.jasypt.encryption.StringEncryptor;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
Expand Down Expand Up @@ -236,7 +235,7 @@ void shouldConvertCategoryParametersToWidgetParameters() {

assertThat(widgetParam.getName()).isEqualTo("key");
assertThat(widgetParam.getDefaultValue()).isEqualTo("value");
Assertions.assertThat(widgetParam.getType()).isEqualTo(DataTypeEnum.TEXT);
assertThat(widgetParam.getType()).isEqualTo(DataTypeEnum.TEXT);
assertThat(widgetParam.getDescription()).isEqualTo("key");
assertThat(widgetParam.isRequired()).isTrue();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import java.util.Date;
import java.util.List;
import java.util.Optional;
import org.assertj.core.api.Assertions;
import org.jasypt.encryption.StringEncryptor;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
Expand Down Expand Up @@ -296,7 +295,7 @@ void shouldUpdateStateNoDate() {

projectWidgetService.updateState(WidgetStateEnum.STOPPED, 1L);

Assertions.assertThat(projectWidget.getState())
assertThat(projectWidget.getState())
.isEqualTo(WidgetStateEnum.STOPPED);

verify(projectWidgetRepository)
Expand Down Expand Up @@ -334,7 +333,7 @@ void shouldUpdateState() {
Date now = Date.from(Instant.parse("2000-01-01T01:00:00.00Z"));
projectWidgetService.updateState(WidgetStateEnum.STOPPED, 1L, now);

Assertions.assertThat(projectWidget.getState())
assertThat(projectWidget.getState())
.isEqualTo(WidgetStateEnum.STOPPED);
assertThat(projectWidget.getLastExecutionDate())
.isEqualTo(now);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import java.util.Collections;
import java.util.Optional;
import java.util.Set;
import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mapstruct.factory.Mappers;
Expand Down Expand Up @@ -189,7 +188,7 @@ void shouldRegisterUser() {
.isEqualTo("email");
assertThat(actual.getAvatarUrl())
.isEqualTo("avatar");
Assertions.assertThat(actual.getAuthenticationMethod())
assertThat(actual.getAuthenticationMethod())
.isEqualTo(AuthenticationProvider.LDAP);
assertThat(actual.getRoles())
.contains(role);
Expand Down Expand Up @@ -256,7 +255,7 @@ void shouldRegisterUserUsernameAlreadyTaken() {
.isEqualTo("email");
assertThat(actual.getAvatarUrl())
.isEqualTo("avatar");
Assertions.assertThat(actual.getAuthenticationMethod())
assertThat(actual.getAuthenticationMethod())
.isEqualTo(AuthenticationProvider.LDAP);
assertThat(actual.getRoles())
.contains(role);
Expand Down Expand Up @@ -327,7 +326,7 @@ void shouldUpdateRegisteredUser() {
.isEqualTo("email");
assertThat(actual.getAvatarUrl())
.isEqualTo("avatar");
Assertions.assertThat(actual.getAuthenticationMethod())
assertThat(actual.getAuthenticationMethod())
.isEqualTo(AuthenticationProvider.LDAP);
assertThat(actual.getRoles())
.contains(role);
Expand Down Expand Up @@ -384,7 +383,7 @@ void shouldUpdate() {
.isEqualTo("email");
assertThat(actual.getAvatarUrl())
.isEqualTo("avatar");
Assertions.assertThat(actual.getAuthenticationMethod())
assertThat(actual.getAuthenticationMethod())
.isEqualTo(AuthenticationProvider.LDAP);
assertThat(actual.getRoles())
.contains(role);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import com.michelin.suricate.model.enumeration.DataTypeEnum;
import com.michelin.suricate.util.IdUtils;
import java.util.Collections;
import org.assertj.core.api.Assertions;
import org.jetbrains.annotations.NotNull;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
Expand Down Expand Up @@ -103,7 +102,7 @@ void shouldToCategoryParameterDto() {

assertThat(actual.getKey()).isEqualTo("key");
assertThat(actual.getValue()).isEqualTo("value");
Assertions.assertThat(actual.getDataType()).isEqualTo(DataTypeEnum.TEXT);
assertThat(actual.getDataType()).isEqualTo(DataTypeEnum.TEXT);
assertThat(actual.isExport()).isTrue();
assertThat(actual.getDescription()).isEqualTo("description");

Expand All @@ -129,7 +128,7 @@ void shouldToCategoryParameterWithHiddenValuesDto() {

assertThat(actual.getKey()).isEqualTo("key");
assertThat(actual.getValue()).isEqualTo("value");
Assertions.assertThat(actual.getDataType()).isEqualTo(DataTypeEnum.TEXT);
assertThat(actual.getDataType()).isEqualTo(DataTypeEnum.TEXT);
assertThat(actual.isExport()).isTrue();
assertThat(actual.getDescription()).isEqualTo("description");
assertThat(actual.getCategory()).isNull();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
Expand Down Expand Up @@ -56,10 +55,10 @@ void shouldToProjectGridEntity() {

assertThat(actual.getTime()).isEqualTo(60);
assertThat(actual.getProject()).isEqualTo(project);
Assertions.assertThat(actual.getCreatedBy()).isEqualTo("createdBy");
Assertions.assertThat(actual.getCreatedDate()).isEqualTo(Date.from(Instant.parse("2000-01-01T01:00:00.00Z")));
Assertions.assertThat(actual.getLastModifiedBy()).isEqualTo("lastModifiedBy");
Assertions.assertThat(actual.getLastModifiedDate())
assertThat(actual.getCreatedBy()).isEqualTo("createdBy");
assertThat(actual.getCreatedDate()).isEqualTo(Date.from(Instant.parse("2000-01-01T01:00:00.00Z")));
assertThat(actual.getLastModifiedBy()).isEqualTo("lastModifiedBy");
assertThat(actual.getLastModifiedDate())
.isEqualTo(Date.from(Instant.parse("2000-01-01T01:00:00.00Z")));
}

Expand Down Expand Up @@ -100,10 +99,10 @@ void shouldToImportExportProjectGridDto() {
assertThat(actual.getTime()).isEqualTo(10);
assertThat(actual.getWidgets().get(0).getWidgetTechnicalName()).isEqualTo("technicalName");
assertThat(actual.getWidgets().get(0).getBackendConfig()).isEqualTo("key=value");
Assertions.assertThat(actual.getWidgets().get(0).getWidgetPosition().getGridColumn()).isEqualTo(1);
Assertions.assertThat(actual.getWidgets().get(0).getWidgetPosition().getGridRow()).isEqualTo(1);
Assertions.assertThat(actual.getWidgets().get(0).getWidgetPosition().getHeight()).isEqualTo(1);
Assertions.assertThat(actual.getWidgets().get(0).getWidgetPosition().getWidth()).isEqualTo(1);
assertThat(actual.getWidgets().get(0).getWidgetPosition().getGridColumn()).isEqualTo(1);
assertThat(actual.getWidgets().get(0).getWidgetPosition().getGridRow()).isEqualTo(1);
assertThat(actual.getWidgets().get(0).getWidgetPosition().getHeight()).isEqualTo(1);
assertThat(actual.getWidgets().get(0).getWidgetPosition().getWidth()).isEqualTo(1);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.assertj.core.api.Assertions;
import org.jetbrains.annotations.NotNull;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
Expand Down Expand Up @@ -125,12 +124,12 @@ void shouldToProjectDto() {
assertThat(actual.getGridProperties().getMaxColumn()).isEqualTo(1);
assertThat(actual.getGridProperties().getWidgetHeight()).isEqualTo(1);
assertThat(actual.getGridProperties().getCssStyle()).isEqualTo("style");
Assertions.assertThat(actual.getImage().getId()).isEqualTo(1L);
Assertions.assertThat(actual.getImage().getContent()).isEqualTo(new byte[10]);
Assertions.assertThat(actual.getImage().getSize()).isEqualTo(10);
Assertions.assertThat(actual.getImage().getContentType()).isEqualTo("contentType");
Assertions.assertThat(actual.getGrids().get(0).getId()).isEqualTo(1L);
Assertions.assertThat(actual.getGrids().get(0).getTime()).isEqualTo(10);
assertThat(actual.getImage().getId()).isEqualTo(1L);
assertThat(actual.getImage().getContent()).isEqualTo(new byte[10]);
assertThat(actual.getImage().getSize()).isEqualTo(10);
assertThat(actual.getImage().getContentType()).isEqualTo("contentType");
assertThat(actual.getGrids().get(0).getId()).isEqualTo(1L);
assertThat(actual.getGrids().get(0).getTime()).isEqualTo(10);
}
}

Expand Down Expand Up @@ -182,12 +181,12 @@ void shouldToProjectDtoNoLibrary() {
assertThat(actual.getGridProperties().getMaxColumn()).isEqualTo(1);
assertThat(actual.getGridProperties().getWidgetHeight()).isEqualTo(1);
assertThat(actual.getGridProperties().getCssStyle()).isEqualTo("style");
Assertions.assertThat(actual.getImage().getId()).isEqualTo(1L);
Assertions.assertThat(actual.getImage().getContent()).isEqualTo(new byte[10]);
Assertions.assertThat(actual.getImage().getSize()).isEqualTo(10);
Assertions.assertThat(actual.getImage().getContentType()).isEqualTo("contentType");
Assertions.assertThat(actual.getGrids().get(0).getId()).isEqualTo(1L);
Assertions.assertThat(actual.getGrids().get(0).getTime()).isEqualTo(10);
assertThat(actual.getImage().getId()).isEqualTo(1L);
assertThat(actual.getImage().getContent()).isEqualTo(new byte[10]);
assertThat(actual.getImage().getSize()).isEqualTo(10);
assertThat(actual.getImage().getContentType()).isEqualTo("contentType");
assertThat(actual.getGrids().get(0).getId()).isEqualTo(1L);
assertThat(actual.getGrids().get(0).getTime()).isEqualTo(10);
}
}

Expand Down Expand Up @@ -228,7 +227,7 @@ void shouldToProjectDtoNoAsset() {
assertThat(actual.getGridProperties().getMaxColumn()).isEqualTo(1);
assertThat(actual.getGridProperties().getWidgetHeight()).isEqualTo(1);
assertThat(actual.getGridProperties().getCssStyle()).isEqualTo("style");
Assertions.assertThat(actual.getImage()).isNull();
assertThat(actual.getImage()).isNull();
}

@Test
Expand Down Expand Up @@ -279,12 +278,12 @@ void shouldToProjectsDtos() {
assertThat(actual.get(0).getGridProperties().getMaxColumn()).isEqualTo(1);
assertThat(actual.get(0).getGridProperties().getWidgetHeight()).isEqualTo(1);
assertThat(actual.get(0).getGridProperties().getCssStyle()).isEqualTo("style");
Assertions.assertThat(actual.get(0).getImage().getId()).isEqualTo(1L);
Assertions.assertThat(actual.get(0).getImage().getContent()).isEqualTo(new byte[10]);
Assertions.assertThat(actual.get(0).getImage().getSize()).isEqualTo(10);
Assertions.assertThat(actual.get(0).getImage().getContentType()).isEqualTo("contentType");
Assertions.assertThat(actual.get(0).getGrids().get(0).getId()).isEqualTo(1L);
Assertions.assertThat(actual.get(0).getGrids().get(0).getTime()).isEqualTo(10);
assertThat(actual.get(0).getImage().getId()).isEqualTo(1L);
assertThat(actual.get(0).getImage().getContent()).isEqualTo(new byte[10]);
assertThat(actual.get(0).getImage().getSize()).isEqualTo(10);
assertThat(actual.get(0).getImage().getContentType()).isEqualTo("contentType");
assertThat(actual.get(0).getGrids().get(0).getId()).isEqualTo(1L);
assertThat(actual.get(0).getGrids().get(0).getTime()).isEqualTo(10);
}
}

Expand Down Expand Up @@ -344,9 +343,9 @@ void shouldToImportExportProjectDto() {
assertThat(actual.getName()).isEqualTo("name");
assertThat(actual.getToken()).isEqualTo("token");
assertThat(actual.isDisplayProgressBar()).isTrue();
Assertions.assertThat(actual.getGridProperties().getMaxColumn()).isEqualTo(1);
Assertions.assertThat(actual.getGridProperties().getWidgetHeight()).isEqualTo(1);
Assertions.assertThat(actual.getGridProperties().getCssStyle()).isEqualTo("style");
assertThat(actual.getGridProperties().getMaxColumn()).isEqualTo(1);
assertThat(actual.getGridProperties().getWidgetHeight()).isEqualTo(1);
assertThat(actual.getGridProperties().getCssStyle()).isEqualTo("style");
assertThat(actual.getImage().getContent()).isEqualTo(new byte[10]);
assertThat(actual.getImage().getContentType()).isEqualTo("contentType");
assertThat(actual.getImage().getSize()).isEqualTo(10);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import com.michelin.suricate.model.enumeration.UserRoleEnum;
import java.util.Collections;
import java.util.List;
import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
Expand Down Expand Up @@ -61,7 +60,7 @@ void shouldToAdminUserDto() {
assertThat(actual.getFirstname()).isEqualTo("firstname");
assertThat(actual.getLastname()).isEqualTo("lastname");
assertThat(actual.getUsername()).isEqualTo("username");
Assertions.assertThat(actual.getRoles().get(0)).isEqualTo(roleResponseDto);
assertThat(actual.getRoles().get(0)).isEqualTo(roleResponseDto);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import com.michelin.suricate.model.entity.UserSetting;
import java.util.Collections;
import java.util.List;
import org.assertj.core.api.Assertions;
import org.jetbrains.annotations.NotNull;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
Expand Down Expand Up @@ -51,7 +50,7 @@ void shouldToUserSettingDto() {
assertThat(actual.getUserId()).isEqualTo(1L);
assertThat(actual.getUnconstrainedValue()).isEqualTo("value");
assertThat(actual.getSetting()).isEqualTo(settingResponseDto);
Assertions.assertThat(actual.getSettingValue()).isEqualTo(allowedSettingValueResponseDto);
assertThat(actual.getSettingValue()).isEqualTo(allowedSettingValueResponseDto);
}

@Test
Expand All @@ -74,7 +73,7 @@ void shouldToUserSettingsDtos() {
assertThat(actual.get(0).getUserId()).isEqualTo(1L);
assertThat(actual.get(0).getUnconstrainedValue()).isEqualTo("value");
assertThat(actual.get(0).getSetting()).isEqualTo(settingResponseDto);
Assertions.assertThat(actual.get(0).getSettingValue()).isEqualTo(allowedSettingValueResponseDto);
assertThat(actual.get(0).getSettingValue()).isEqualTo(allowedSettingValueResponseDto);
}

@NotNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import com.michelin.suricate.util.IdUtils;
import java.util.Collections;
import java.util.List;
import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
Expand All @@ -37,7 +36,7 @@ class WidgetMapperTest {
private WidgetMapperImpl widgetMapper;

@Test
void shouldtoWidgetDto() {
void shouldConvertToWidgetDto() {
try (MockedStatic<IdUtils> mocked = mockStatic(IdUtils.class)) {
Asset asset = new Asset();
asset.setId(1L);
Expand Down Expand Up @@ -91,16 +90,16 @@ void shouldtoWidgetDto() {
assertThat(actual.getTimeout()).isEqualTo(1L);
assertThat(actual.getWidgetAvailability()).isEqualTo(WidgetAvailabilityEnum.ACTIVATED);
assertThat(actual.getImageToken()).isEqualTo("encrypted");
Assertions.assertThat(actual.getImage()).isNull();
assertThat(actual.getImage()).isNull();
assertThat(actual.getLibraryTechnicalNames()).isNull();
Assertions.assertThat(actual.getCategory()).isEqualTo(categoryResponseDto);
assertThat(actual.getCategory()).isEqualTo(categoryResponseDto);
assertThat(actual.getRepositoryId()).isEqualTo(1L);
assertThat(actual.getParams().get(0)).isEqualTo(widgetParamResponseDto);
}
}

@Test
void shouldtoWidgetWithoutCategoryParametersDto() {
void shouldConvertToWidgetWithoutCategoryParametersDto() {
try (MockedStatic<IdUtils> mocked = mockStatic(IdUtils.class)) {
Asset asset = new Asset();
asset.setId(1L);
Expand Down Expand Up @@ -154,16 +153,16 @@ void shouldtoWidgetWithoutCategoryParametersDto() {
assertThat(actual.getTimeout()).isEqualTo(1L);
assertThat(actual.getWidgetAvailability()).isEqualTo(WidgetAvailabilityEnum.ACTIVATED);
assertThat(actual.getImageToken()).isEqualTo("encrypted");
Assertions.assertThat(actual.getImage()).isNull();
assertThat(actual.getImage()).isNull();
assertThat(actual.getLibraryTechnicalNames()).isNull();
Assertions.assertThat(actual.getCategory()).isEqualTo(categoryResponseDto);
assertThat(actual.getCategory()).isEqualTo(categoryResponseDto);
assertThat(actual.getRepositoryId()).isEqualTo(1L);
assertThat(actual.getParams().get(0)).isEqualTo(widgetParamResponseDto);
}
}

@Test
void shouldtoWidgetsDtos() {
void shouldConvertToWidgetsDtos() {
try (MockedStatic<IdUtils> mocked = mockStatic(IdUtils.class)) {
Asset asset = new Asset();
asset.setId(1L);
Expand Down Expand Up @@ -217,9 +216,9 @@ void shouldtoWidgetsDtos() {
assertThat(actual.get(0).getTimeout()).isEqualTo(1L);
assertThat(actual.get(0).getWidgetAvailability()).isEqualTo(WidgetAvailabilityEnum.ACTIVATED);
assertThat(actual.get(0).getImageToken()).isEqualTo("encrypted");
Assertions.assertThat(actual.get(0).getImage()).isNull();
assertThat(actual.get(0).getImage()).isNull();
assertThat(actual.get(0).getLibraryTechnicalNames()).isNull();
Assertions.assertThat(actual.get(0).getCategory()).isEqualTo(categoryResponseDto);
assertThat(actual.get(0).getCategory()).isEqualTo(categoryResponseDto);
assertThat(actual.get(0).getRepositoryId()).isEqualTo(1L);
assertThat(actual.get(0).getParams().get(0)).isEqualTo(widgetParamResponseDto);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class WidgetParamValueMapperTest {
private WidgetParamValueMapperImpl widgetParamValueMapper;

@Test
void shouldtoWidgetParameterValueDto() {
void shouldConvertToWidgetParameterValueDto() {
WidgetParamValue widgetParamValue = new WidgetParamValue();
widgetParamValue.setId(1L);
widgetParamValue.setJsKey("key");
Expand All @@ -30,7 +30,7 @@ void shouldtoWidgetParameterValueDto() {
}

@Test
void shouldtoWidgetParameterValuesDtos() {
void shouldConvertToWidgetParameterValuesDtos() {
WidgetParamValue widgetParamValue = new WidgetParamValue();
widgetParamValue.setId(1L);
widgetParamValue.setJsKey("key");
Expand Down
Loading

0 comments on commit c69452e

Please sign in to comment.