Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #101 from alexeiak/tests_branch
test: [#100] add tests for all TODO in repository/WorkspaceRepository
- Loading branch information
Showing
12 changed files
with
570 additions
and
358 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
src/test/java/io/hexlet/typoreporter/service/converter/TypoToTypoInfoConverterTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package io.hexlet.typoreporter.service.converter; | ||
|
||
import io.hexlet.typoreporter.domain.typo.Typo; | ||
import io.hexlet.typoreporter.service.dto.typo.TypoInfo; | ||
import org.junit.jupiter.params.ParameterizedTest; | ||
import org.junit.jupiter.params.provider.MethodSource; | ||
import org.springframework.core.convert.converter.Converter; | ||
|
||
import static io.hexlet.typoreporter.test.asserts.TypoInfoAssert.assertThat; | ||
|
||
public class TypoToTypoInfoConverterTest { | ||
private final Converter<Typo, TypoInfo> converter = new TypoToTypoInfoConverter(); | ||
|
||
@ParameterizedTest | ||
@MethodSource("io.hexlet.typoreporter.test.factory.EntitiesFactory#getTypos") | ||
void requestToTypoInfo(final Typo typo) { | ||
final var typoInfo = converter.convert(typo); | ||
assertThat(typoInfo).isEqualsToTypoInfo(typo); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
src/test/java/io/hexlet/typoreporter/service/converter/WorkspaceToWorkspaceInfoTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package io.hexlet.typoreporter.service.converter; | ||
|
||
import io.hexlet.typoreporter.domain.workspace.Workspace; | ||
import io.hexlet.typoreporter.service.dto.workspace.WorkspaceInfo; | ||
import org.junit.jupiter.params.ParameterizedTest; | ||
import org.junit.jupiter.params.provider.MethodSource; | ||
import org.springframework.core.convert.converter.Converter; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
public class WorkspaceToWorkspaceInfoTest { | ||
private final Converter<Workspace, WorkspaceInfo> converter = new WorkspaceToWorkspaceInfo(); | ||
|
||
@ParameterizedTest | ||
@MethodSource("io.hexlet.typoreporter.test.factory.EntitiesFactory#getWorkspaces") | ||
void requestWorkspaceToInfo(final Workspace workspace) { | ||
final var workspaceInfo = converter.convert(workspace); | ||
assertThat(workspaceInfo).usingRecursiveComparison() | ||
.ignoringFields("createdBy", "createdDate", "createdDateAgo", "modifiedBy", "modifiedDate", "modifiedDateAgo") | ||
.isEqualTo(workspace); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
src/test/java/io/hexlet/typoreporter/test/asserts/TypoInfoAssert.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package io.hexlet.typoreporter.test.asserts; | ||
|
||
import io.hexlet.typoreporter.domain.typo.Typo; | ||
import io.hexlet.typoreporter.service.dto.typo.TypoInfo; | ||
import org.assertj.core.api.ObjectAssert; | ||
|
||
public class TypoInfoAssert extends ObjectAssert<TypoInfo> { | ||
|
||
public TypoInfoAssert(TypoInfo typoInfo) { | ||
super(typoInfo); | ||
} | ||
|
||
public static TypoInfoAssert assertThat(TypoInfo actual) { | ||
return new TypoInfoAssert(actual); | ||
} | ||
|
||
public TypoInfoAssert isEqualsToTypoInfo(Typo expected) { | ||
isNotNull(); | ||
assertThat(actual) | ||
.usingRecursiveComparison() | ||
.ignoringFields("typoStatusStr", "createdBy", "createdDateAgo", "createdDate", "modifiedBy", "modifiedDateAgo", "modifiedDate", "account") | ||
.isEqualTo(expected); | ||
return this; | ||
} | ||
} |
Oops, something went wrong.