question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Generating other than .java files testing

See original GitHub issue

I 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:closed
  • Created 7 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
tbroyercommented, Oct 22, 2016

Are you looking for generatesFileNamed(…).withStringContent(…)?

0reactions
vegegokucommented, Oct 22, 2016

Yup you are right. running mvn dependency:tree and i found that i am using com.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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found