-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Formatting and Java 11 refactors (#657)
* Removed custom 'map()' constructors * Several minor refactors * Add unit testing for AsciidoctorHelper * Removed 'public' modifiers from tests * Deleted unused class AsciidoctorConversionException * Removed unused 'sourceDirectory' from MemoryLogHandler
- Loading branch information
1 parent
bbbd28a
commit 192c1c2
Showing
53 changed files
with
398 additions
and
464 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,5 +66,4 @@ else if (value instanceof Boolean) { | |
attributesBuilder.attribute(attribute, value); | ||
} | ||
} | ||
|
||
} |
13 changes: 0 additions & 13 deletions
13
...maven-commons/src/main/java/org/asciidoctor/maven/log/AsciidoctorConversionException.java
This file was deleted.
Oops, something went wrong.
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
43 changes: 43 additions & 0 deletions
43
...ctor-maven-commons/src/test/java/org/asciidoctor/maven/commons/AsciidoctorHelperTest.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,43 @@ | ||
package org.asciidoctor.maven.commons; | ||
|
||
import org.asciidoctor.Attributes; | ||
import org.asciidoctor.AttributesBuilder; | ||
import org.assertj.core.data.MapEntry; | ||
import org.junit.jupiter.params.ParameterizedTest; | ||
import org.junit.jupiter.params.provider.Arguments; | ||
import org.junit.jupiter.params.provider.MethodSource; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
import java.util.stream.Stream; | ||
|
||
import static org.asciidoctor.maven.commons.AsciidoctorHelper.addAttributes; | ||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
public class AsciidoctorHelperTest { | ||
|
||
@ParameterizedTest | ||
@MethodSource("specialAttributes") | ||
void should_add_attributes_with_special_values(Object actual, String expected) { | ||
final Map<String, Object> attributes = new HashMap<>(); | ||
attributes.put("toc", actual); | ||
final AttributesBuilder attributesBuilder = Attributes.builder(); | ||
|
||
addAttributes(attributes, attributesBuilder); | ||
|
||
var attributesAsMap = attributesBuilder.build().map(); | ||
assertThat(attributesAsMap) | ||
.containsExactly(MapEntry.entry("toc", expected)); | ||
} | ||
|
||
private static Stream<Arguments> specialAttributes() { | ||
return Stream.of( | ||
Arguments.of(null, ""), | ||
Arguments.of("", ""), | ||
Arguments.of("true", ""), | ||
Arguments.of("false", null), | ||
Arguments.of(true, ""), | ||
Arguments.of(false, null) | ||
); | ||
} | ||
} |
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
Oops, something went wrong.