Skip to content

Commit

Permalink
fix: upgrade to lsd-core 3.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
nickmcdowall committed Apr 10, 2023
1 parent 3fdd227 commit 5f97811
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 39 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ repositories {
}

dependencies {
api 'io.github.lsd-consulting:lsd-core:3.2.6'
api 'io.github.lsd-consulting:lsd-core:3.4.0'
implementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'
implementation 'org.junit.jupiter:junit-jupiter-engine:5.8.2'
implementation 'com.j2html:j2html:1.5.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,8 @@
<span onclick="location.href='lsd-index.html';" title="back to index page" class="back_to_index"></span>
<h1 class="logo">LSD</h1>
<h1>Aborted Test Report</h1>
<div class="contents">
<h3>Contents</h3>
<ul class="contents">

<li class="warn"><a href="#2">The test name</a></li>

</ul>
</div>




<article id="2">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,8 @@
<span onclick="location.href='lsd-index.html';" title="back to index page" class="back_to_index"></span>
<h1 class="logo">LSD</h1>
<h1>Disabled Test Report</h1>
<div class="contents">
<h3>Contents</h3>
<ul class="contents">

<li class="warn"><a href="#1">The test name</a></li>

</ul>
</div>




<article id="1">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,8 @@
<span onclick="location.href='lsd-index.html';" title="back to index page" class="back_to_index"></span>
<h1 class="logo">LSD</h1>
<h1>Failure Test Report</h1>
<div class="contents">
<h3>Contents</h3>
<ul class="contents">

<li class="error"><a href="#2">The test name</a></li>

</ul>
</div>




<article id="2">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,8 @@
<span onclick="location.href='lsd-index.html';" title="back to index page" class="back_to_index"></span>
<h1 class="logo">LSD</h1>
<h1>Successful Test Report</h1>
<div class="contents">
<h3>Contents</h3>
<ul class="contents">

<li class="success"><a href="#1">The test name</a></li>

</ul>
</div>




<article id="1">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
import org.junit.jupiter.api.extension.ExtensionContext;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
import java.util.Optional;

import static com.lsd.core.properties.LsdProperties.OUTPUT_DIR;
Expand Down Expand Up @@ -37,30 +41,30 @@ void approvalTestForTestFailedCallback() {
}

@Test
void approvalTestForTestSuccessfulCallback() {
void approvalTestForTestSuccessfulCallback() throws IOException {
configureMockContextToReturnDisplayNames();

lsdExtension.testSuccessful(mockTestContext);

Approvals.verify(lsdContext.completeReport("Successful Test Report").toFile());
Approvals.verify(copyOfFile(lsdContext.completeReport("Successful Test Report")));
}

@Test
void approvalTestForTestAbortedCallback() {
void approvalTestForTestAbortedCallback() throws IOException {
configureMockContextToReturnDisplayNames();

lsdExtension.testAborted(mockTestContext, new RuntimeException("Aborted for testing reasons"));

Approvals.verify(lsdContext.completeReport("Aborted Test Report").toFile());
Approvals.verify(copyOfFile(lsdContext.completeReport("Aborted Test Report")));
}

@Test
void approvalTestForTestDisabledCallback() {
void approvalTestForTestDisabledCallback() throws IOException {
configureMockContextToReturnDisplayNames();

lsdExtension.testDisabled(mockTestContext, Optional.of("Disabled reason"));

Approvals.verify(lsdContext.completeReport("Disabled Test Report").toFile());
Approvals.verify(copyOfFile(lsdContext.completeReport("Disabled Test Report")));
}

@Test
Expand Down Expand Up @@ -92,4 +96,10 @@ private void configureMockContextToReturnDisplayNames() {
.thenReturn(Optional.of(mockTestContext))
.thenReturn(Optional.empty());
}

private File copyOfFile(Path original) throws IOException {
Path copy = Path.of(original.getParent().toString(), "copy_" + original.getFileName());
Files.copy(original, copy, StandardCopyOption.REPLACE_EXISTING);
return copy.toFile();
}
}

0 comments on commit 5f97811

Please sign in to comment.