Generating other than .java files testing
See original GitHub issueI am trying to generate an HTML out fro annotated classes and i need to write unit testing for the generated .html files:
when i am generating .java files i testing them like this:
Truth.assert_().about(javaSource()).that(JavaFileObjects.forResource("source class .java goes here"))
.processedWith(new UiFormProcessor()).compilesWithoutError()
.and()
.generatesSources(JavaFileObjects.forSourceString("","expected generated class content goes here"));
and that works for me very well.
but when i am trying to generate an .html file and use the same code above, it result in an error like this
java.lang.AssertionError: Did not find a generated file corresponding to .java
its seems that the generated files are expected to be java files all the time, i have been trying to figure out if i am calling the wrong methods or passing wrong arguments, but i could’nt make it work.
is there anyway to test none java generated sources like hml with this tool?
Issue Analytics
- State:
- Created 7 years ago
- Comments:5
Top Results From Across the Web
Working and unit testing with temporary files in Java
Temporary files are frequently used in testing and in production. Here is how to create and manage—and delete—them.
Read more >Squaretest - Java Unit Test Generator for IntelliJ IDEA
Automatically generate unit tests for your Java classes with the Squaretest plugin for IntelliJ IDEA. Install Examples.
Read more >Create tests | IntelliJ IDEA Documentation - JetBrains
The simplest way of creating a new test class in IntelliJ IDEA is by using a dedicated intention action that you can invoke...
Read more >Java - JUnit Test Generators - Stack Overflow
I use the Eclipse plugin MoreUnit. It can generate TestClasses and test-methods. It also shows which methods have test methods .
Read more >Generate a JUnit Test for any Java class in the IDE - YouTube
Brief tutorial demonstrating how to generate a JUnit test class for any of your existing Java classes in the Eclipse IDE.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Are you looking for
generatesFileNamed(…).withStringContent(…)
?Yup you are right. running
mvn dependency:tree
and i found that i am usingcom.google.auto.service:auto-service:1.0-rc1
which depends on guava 16, updating to auto-service:1.0-rc2 resolved the issue since it depends on guava 18.thanks.