Skip to content

Commit

Permalink
Add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ksclarke committed Nov 18, 2024
1 parent 7fe4669 commit 9db7e18
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<!-- Plugin related versions -->
<docker.plugin.version>0.45.0</docker.plugin.version>
<deploy.plugin.version>3.1.3</deploy.plugin.version>
<maven.shade.version>3.6.0</maven.shade.version>
<shade.plugin.version>3.6.0</shade.plugin.version>

<!-- Test dependency versions -->
<junit.version>5.11.0</junit.version>
Expand Down Expand Up @@ -113,7 +113,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>${maven.shade.version}</version>
<version>${shade.plugin.version}</version>
<executions>
<execution>
<id>uber-jar</id>
Expand Down Expand Up @@ -328,7 +328,7 @@
</execution>

<!-- Deploys the application's Docker image -->

<execution>
<id>docker-deploy</id>
<phase>deploy</phase>
Expand Down
17 changes: 13 additions & 4 deletions src/main/java/info/freelibrary/iiif/webrepl/DiagConsumer.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,28 @@ public void accept(final Diag aDiagnostic) {
int start = (int) aDiagnostic.getStartPosition();
int end = (int) aDiagnostic.getEndPosition();

// Isolate and highlight the problem (with brackets)
if (start == end) {
myBuffer.insert(start, START).insert(start + START.length(), END);
} else {
myBuffer.insert(start, START).insert(end, END);
myBuffer.insert(start, START).insert(end + START.length(), END);
}

end = myBuffer.indexOf(TEMPLATE_START) + TEMPLATE_START.length() + 2;
start = myBuffer.length() - 4;
// If the code snippet includes the multi-line template, remove it
if (myBuffer.toString().contains(TEMPLATE_START)) {
end = myBuffer.indexOf(TEMPLATE_START) + TEMPLATE_START.length() + 2;
start = myBuffer.length() - 4;

myBuffer.delete(start, myBuffer.length()).delete(0, end);
myBuffer.delete(start, myBuffer.length()).delete(0, end);
}

// Add line numbers to what's returned
code = StringUtils.addLineNumbers(myBuffer.toString());

// Zero out the output buffer
myBuffer.setLength(0);

// Format the output and prepare to return it
myBuffer.append(INTRO).append(EOLX2).append(code).append(EOLX2).append(HEADER).append(message).append(EOL);
}

Expand Down

0 comments on commit 9db7e18

Please sign in to comment.