-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
34 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.thoughtworks.qdox; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
import java.io.StringReader; | ||
|
||
import org.junit.Test; | ||
|
||
import com.thoughtworks.qdox.model.JavaField; | ||
import com.thoughtworks.qdox.model.JavaSource; | ||
|
||
/** | ||
* Examples from <a href="https://docs.oracle.com/en/java/javase/16/text-blocks/index.html">https://docs.oracle.com/en/java/javase/16/text-blocks/index.html</a> | ||
* @author Robert Scholte | ||
* | ||
*/ | ||
public class TextBlocksTest | ||
{ | ||
private JavaProjectBuilder builder = new JavaProjectBuilder(); | ||
|
||
@Test | ||
public void test() | ||
{ | ||
String source = "interface Something { " | ||
+ "// Using a text block\r\n" | ||
+ "String tbName = \"\"\"\r\n" | ||
+ " Pat Q. Smith\"\"\"; }"; | ||
JavaSource javaSource = builder.addSource( new StringReader( source ) ); | ||
JavaField javaField = javaSource.getClasses().get( 0 ).getFieldByName( "tbName" ); | ||
assertEquals( "\"\"\"\r\n" | ||
+ " Pat Q. Smith\"\"\"", javaField.getInitializationExpression() ); | ||
} | ||
|
||
} |