Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
cs2-19wi
project02
Commits
ea3f25d0
Commit
ea3f25d0
authored
6 years ago
by
Adam Blank
Browse files
Options
Download
Plain Diff
Merge branch 'jkarras' into 'master'
Updated GuesserTests.java See merge request
!2
parents
da6fe676
b7ebf5d6
master
jkarras
revert-b35e36b1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/edu/caltech/cs2/project02/GuesserTests.java
+6
-4
tests/edu/caltech/cs2/project02/GuesserTests.java
with
6 additions
and
4 deletions
+6
-4
tests/edu/caltech/cs2/project02/GuesserTests.java
View file @
ea3f25d0
...
...
@@ -79,6 +79,7 @@ public class GuesserTests {
Constructor
c
=
Reflection
.
getConstructor
(
RandomHangmanChooser
.
class
,
int
.
class
,
int
.
class
);
assertThrows
(
IllegalArgumentException
.
class
,
()
->
Reflection
.
newInstance
(
c
,
-
1
,
3
));
assertThrows
(
IllegalArgumentException
.
class
,
()
->
Reflection
.
newInstance
(
c
,
3
,
-
1
));
assertThrows
(
IllegalStateException
.
class
,
()
->
Reflection
.
newInstance
(
c
,
Integer
.
MAX_VALUE
,
3
));
}
@Order
(
3
)
...
...
@@ -89,8 +90,8 @@ public class GuesserTests {
Constructor
c
=
Reflection
.
getConstructor
(
RandomHangmanChooser
.
class
,
int
.
class
,
int
.
class
);
RandomHangmanChooser
chooser
=
Reflection
.
newInstance
(
c
,
1
,
1
);
Method
m
=
Reflection
.
getMethod
(
RandomHangmanChooser
.
class
,
"makeGuess"
,
char
.
class
);
IntStream
.
range
(
0
,
20
).
forEach
(
i
->
assertThrows
(
IllegalArgumentException
.
class
,
()
->
m
.
invoke
(
m
,
chooser
,
'a'
-
(
i
+
1
))));
IntStream
.
range
(
0
,
20
).
forEach
(
i
->
assertThrows
(
IllegalArgumentException
.
class
,
()
->
m
.
invoke
(
m
,
chooser
,
'z'
+
(
i
+
1
))));
IntStream
.
range
(
0
,
20
).
forEach
(
i
->
assertThrows
(
IllegalArgumentException
.
class
,
()
->
m
.
invoke
(
chooser
,
(
char
)
(
'a'
-
(
i
+
1
))))
)
;
IntStream
.
range
(
0
,
20
).
forEach
(
i
->
assertThrows
(
IllegalArgumentException
.
class
,
()
->
m
.
invoke
(
chooser
,
(
char
)
(
'z'
+
(
i
+
1
))))
)
;
}
...
...
@@ -194,6 +195,7 @@ public class GuesserTests {
Constructor
c
=
Reflection
.
getConstructor
(
EvilHangmanChooser
.
class
,
int
.
class
,
int
.
class
);
assertThrows
(
IllegalArgumentException
.
class
,
()
->
Reflection
.
newInstance
(
c
,
-
1
,
3
));
assertThrows
(
IllegalArgumentException
.
class
,
()
->
Reflection
.
newInstance
(
c
,
3
,
-
1
));
assertThrows
(
IllegalStateException
.
class
,
()
->
Reflection
.
newInstance
(
c
,
Integer
.
MAX_VALUE
,
3
));
}
@Order
(
2
)
...
...
@@ -204,8 +206,8 @@ public class GuesserTests {
Constructor
c
=
Reflection
.
getConstructor
(
EvilHangmanChooser
.
class
,
int
.
class
,
int
.
class
);
EvilHangmanChooser
chooser
=
Reflection
.
newInstance
(
c
,
1
,
1
);
Method
m
=
Reflection
.
getMethod
(
EvilHangmanChooser
.
class
,
"makeGuess"
,
char
.
class
);
IntStream
.
range
(
0
,
20
).
forEach
(
i
->
assertThrows
(
IllegalArgumentException
.
class
,
()
->
m
.
invoke
(
m
,
chooser
,
'a'
-
(
i
+
1
))));
IntStream
.
range
(
0
,
20
).
forEach
(
i
->
assertThrows
(
IllegalArgumentException
.
class
,
()
->
m
.
invoke
(
m
,
chooser
,
'z'
+
(
i
+
1
))));
IntStream
.
range
(
0
,
20
).
forEach
(
i
->
assertThrows
(
IllegalArgumentException
.
class
,
()
->
m
.
invoke
(
chooser
,
(
char
)
(
'a'
-
(
i
+
1
))))
)
;
IntStream
.
range
(
0
,
20
).
forEach
(
i
->
assertThrows
(
IllegalArgumentException
.
class
,
()
->
m
.
invoke
(
chooser
,
(
char
)
(
'z'
+
(
i
+
1
))))
)
;
}
@Order
(
2
)
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help