package blanco.apex.formatter;

import static org.junit.Assert.assertEquals;

import java.io.File;
import java.io.IOException;
import java.util.List;

import org.junit.Test;

import blanco.apex.parser.BlancoApexParserUtil;
import blanco.apex.parser.token.BlancoApexToken;

public class BlancoApexFormatter003Test {
	private static final String TARGET_FILE1 = "./test/data/apex/MySimpleTest2.cls";

	@Test
	public void test() throws IOException {
		final List<BlancoApexToken> tokenList = new BlancoApexFormatter(new BlancoApexFormatterSettings())
				.format(new File(TARGET_FILE1)); //
		if (false)
			System.out.println(BlancoApexParserUtil.tokenList2String(tokenList));
		if (true)
			System.out.println(tokenList.get(0).getDisplayString());

		assertEquals(
				"SOURCE[ANNOTATION[SPECIAL_CHAR[@],WORD[isTest],NEWLINE[n]],CLASS[WORD[public],WHITESPACE[ ],WORD[without],WHITESPACE[ ],WORD[sharing],WHITESPACE[ ],WORD[class],WHITESPACE[ ],WORD[MySimpleTest],BLOCK(CLASS_DEF)[SPECIAL_CHAR[{],NEWLINE[n],WHITESPACE[    ],METHOD[WORD[static]WHITESPACE[ ]WORD[testMethod]WHITESPACE[ ]WORD[void]WHITESPACE[ ]WORD[testMain002]PARENTHESIS[SPECIAL_CHAR[(],SPECIAL_CHAR[)]]BLOCK(METHOD_DEF)[SPECIAL_CHAR[{],NEWLINE[n],WHITESPACE[        ],STATEMENT[WORD[System],SPECIAL_CHAR[.],WORD[assert],PARENTHESIS[SPECIAL_CHAR[(],WORD[false],SPECIAL_CHAR[,],WHITESPACE[ ],LITERAL(STRING)['Hello test world!'],SPECIAL_CHAR[)]],SPECIAL_CHAR[;]],NEWLINE[n],WHITESPACE[    ],SPECIAL_CHAR[}]]],NEWLINE[n],NEWLINE[n],WHITESPACE[    ],METHOD[WORD[static]WHITESPACE[ ]WORD[void]WHITESPACE[ ]WORD[test001]PARENTHESIS[SPECIAL_CHAR[(],SPECIAL_CHAR[)]]BLOCK(METHOD_DEF)[SPECIAL_CHAR[{],NEWLINE[n],WHITESPACE[        ],STATEMENT[WORD[Integer],WHITESPACE[ ],WORD[i],SPECIAL_CHAR[=],LITERAL(NUMBER)[0],SPECIAL_CHAR[;]],NEWLINE[n],WHILE_STATEMENT[WORD[while],PARENTHESIS[SPECIAL_CHAR[(],LITERAL(NUMBER)[5],SPECIAL_CHAR[>],WORD[i],SPECIAL_CHAR[)]],BLOCK(MULTI_STATEMENT)[SPECIAL_CHAR[{],NEWLINE[n],WHITESPACE[            ],STATEMENT[WORD[i],SPECIAL_CHAR[++],SPECIAL_CHAR[;]],NEWLINE[n],WHITESPACE[        ],SPECIAL_CHAR[}]]],NEWLINE[n],WHITESPACE[        ],STATEMENT[WORD[return],SPECIAL_CHAR[;]],NEWLINE[n],WHITESPACE[    ],SPECIAL_CHAR[}]]],NEWLINE[n],WHITESPACE[],SPECIAL_CHAR[}]]],NEWLINE[n]]",
				tokenList.get(0).getDisplayString());
	}
}

@@ -951,16 +951,30 @@
 mpleTest
+%5D,WHITESPACE%5B 
 %5D,BLOCK(
@@ -1164,32 +1164,45 @@
 ,SPECIAL_CHAR%5B)%5D
+%5DWHITESPACE%5B 
 %5DBLOCK(METHOD_DE
@@ -1641,16 +1641,29 @@
 _CHAR%5B)%5D
+%5DWHITESPACE%5B 
 %5DBLOCK(M
@@ -1757,32 +1757,46 @@
 ESPACE%5B %5D,WORD%5Bi
+%5D,WHITESPACE%5B 
 %5D,SPECIAL_CHAR%5B=
@@ -1795,16 +1795,30 @@
 L_CHAR%5B=
+%5D,WHITESPACE%5B 
 %5D,LITERA
@@ -1852,24 +1852,45 @@
 %5D%5D,NEWLINE%5Bn
+%5D,WHITESPACE%5B        
 %5D,WHILE_STAT
@@ -1905,16 +1905,30 @@
 RD%5Bwhile
+%5D,WHITESPACE%5B 
 %5D,PARENT
@@ -1982,16 +1982,30 @@
 L_CHAR%5B%3E
+%5D,WHITESPACE%5B 
 %5D,WORD%5Bi
@@ -2021,16 +2021,30 @@
 _CHAR%5B)%5D
+%5D,WHITESPACE%5B 
 %5D,BLOCK(

update test to adapt actual.