Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Luke Texon
simplewebapp
Commits
5ba3285e
Commit
5ba3285e
authored
Jan 17, 2020
by
Raghav Khanna
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix file names and add file generator tests
parent
809b2d6f
Pipeline
#114197
passed with stages
in 3 minutes and 56 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
1 deletion
+36
-1
src/main/java/ic/doc/web/HtmlConverter.java
src/main/java/ic/doc/web/HtmlConverter.java
+2
-1
src/test/java/ic/doc/FileGenerateTest.java
src/test/java/ic/doc/FileGenerateTest.java
+34
-0
No files found.
src/main/java/ic/doc/web/HtmlConverter.java
View file @
5ba3285e
...
...
@@ -34,7 +34,8 @@ public class HtmlConverter {
}
try
{
String
pdfFilePath
=
mdFile
.
getCanonicalPath
()
+
".pdf"
;
String
canocialPath
=
mdFile
.
getCanonicalPath
();
String
pdfFilePath
=
canocialPath
.
substring
(
0
,
canocialPath
.
length
()
-
3
)
+
".pdf"
;
new
ProcessBuilder
(
"pandoc"
,
mdFile
.
getCanonicalPath
(),
"-o"
,
pdfFilePath
)
.
start
().
waitFor
();
...
...
src/test/java/ic/doc/FileGenerateTest.java
0 → 100644
View file @
5ba3285e
package
ic.doc
;
import
ic.doc.web.HtmlConverter
;
import
org.junit.Test
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
public
class
FileGenerateTest
{
@Test
public
void
generatesMdFile
()
throws
Exception
{
assertTrue
(
HtmlConverter
.
stringToMdFile
(
"tony"
,
"test"
)
!=
null
);
}
@Test
public
void
generatesPdfFile
()
throws
Exception
{
assertTrue
(
HtmlConverter
.
stringToPdfFile
(
"tony"
,
"test"
)
!=
null
);
}
@Test
public
void
reasonableNameForMdFile
()
throws
Exception
{
assertTrue
(
HtmlConverter
.
stringToMdFile
(
"konstantinos"
,
"test"
)
.
getName
()
.
matches
(
"konstantinos[0-9]+.md"
));
}
@Test
public
void
reasonableNameForPdfFile
()
throws
Exception
{
assertTrue
(
HtmlConverter
.
stringToPdfFile
(
"tony"
,
"test"
)
.
getName
()
.
matches
(
"tony[0-9]+.pdf"
));
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment