33import org .junit .Test ;
44
55import static junit .framework .Assert .assertEquals ;
6- import static org .junit .Assert .assertTrue ;
76
87public class QueryTest {
98 @ Test
@@ -13,29 +12,18 @@ public void testStringEscaping() throws Exception {
1312 assertEquals ("\" \\ u0000 \\ r \\ n \\ \\ \\ \" c ꝏ\" " , result .toString ());
1413 }
1514
16- @ Test
17- public void testInvalidAlias () {
18- boolean exceptionThrown = false ;
19- try {
20- new Query <Query >(null ) {
21- }.withAlias ("invalid__alias" );
22- } catch (IllegalArgumentException e ) {
23- exceptionThrown = true ;
24- } finally {
25- assertTrue (exceptionThrown );
26- }
15+ @ Test (expected = IllegalArgumentException .class )
16+ public void testInvalidAliasWithUnderscore () {
17+ new Query <Query >(null ) {}.withAlias ("invalid__alias" );
2718 }
2819
29- @ Test
20+ @ Test (expected = IllegalArgumentException .class )
21+ public void testInvalidAliasWithDashes () {
22+ new Query <Query >(null ) {}.withAlias ("invalid-alias" );
23+ }
24+
25+ @ Test (expected = IllegalArgumentException .class )
3026 public void testBlankAlias () {
31- boolean exceptionThrown = false ;
32- try {
33- new Query <Query >(null ) {
34- }.withAlias ("" );
35- } catch (IllegalArgumentException e ) {
36- exceptionThrown = true ;
37- } finally {
38- assertTrue (exceptionThrown );
39- }
27+ new Query <Query >(null ) {}.withAlias ("" );
4028 }
4129}
0 commit comments