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-24wi
project02
Commits
addf2700
Commit
addf2700
authored
1 year ago
by
Sahil
Browse files
Options
Download
Plain Diff
Merge remote-tracking branch 'origin/qa-fixes' into test_updates
parents
fea86d5a
a5c1bf4d
master
test_updates
No related merge requests found
Pipeline
#94054
failed with stage
in 0 seconds
Changes
5
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
.idea/libraries/junit_jupiter.xml
+9
-9
.idea/libraries/junit_jupiter.xml
.idea/libraries/org_javassist_javassist_3_29_2_GA.xml
+10
-0
.idea/libraries/org_javassist_javassist_3_29_2_GA.xml
project02-hangman.iml
+1
-1
project02-hangman.iml
tests/edu/caltech/cs2/project02/EvilHangmanChooserTests.java
+23
-1
tests/edu/caltech/cs2/project02/EvilHangmanChooserTests.java
tests/edu/caltech/cs2/project02/RandomHangmanChooserTests.java
+24
-1
.../edu/caltech/cs2/project02/RandomHangmanChooserTests.java
with
67 additions
and
12 deletions
+67
-12
.idea/libraries/
org_
junit_jupiter
_junit_jupiter_5_6_0_M1
.xml
→
.idea/libraries/junit_jupiter.xml
View file @
addf2700
<component
name=
"libraryTable"
>
<component
name=
"libraryTable"
>
<library
name=
"
org.
junit.jupiter
:junit-jupiter:5.6.0-M1
"
type=
"repository"
>
<library
name=
"junit.jupiter"
type=
"repository"
>
<properties
maven-id=
"org.junit.jupiter:junit-jupiter:5.
6
.0-M1"
/>
<properties
maven-id=
"org.junit.jupiter:junit-jupiter:5.
9
.0-M1"
/>
<CLASSES>
<CLASSES>
<root
url=
"jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter/5.6.0-M1/junit-jupiter-5.6.0-M1.jar!/"
/>
<root
url=
"jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter/5.9.0-M1/junit-jupiter-5.9.0-M1.jar!/"
/>
<root
url=
"jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-api/5.6.0-M1/junit-jupiter-api-5.6.0-M1.jar!/"
/>
<root
url=
"jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-api/5.9.0-M1/junit-jupiter-api-5.9.0-M1.jar!/"
/>
<root
url=
"jar://$MAVEN_REPOSITORY$/org/apiguardian/apiguardian-api/1.1.0/apiguardian-api-1.1.0.jar!/"
/>
<root
url=
"jar://$MAVEN_REPOSITORY$/org/opentest4j/opentest4j/1.2.0/opentest4j-1.2.0.jar!/"
/>
<root
url=
"jar://$MAVEN_REPOSITORY$/org/opentest4j/opentest4j/1.2.0/opentest4j-1.2.0.jar!/"
/>
<root
url=
"jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-commons/1.6.0-M1/junit-platform-commons-1.6.0-M1.jar!/"
/>
<root
url=
"jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-commons/1.9.0-M1/junit-platform-commons-1.9.0-M1.jar!/"
/>
<root
url=
"jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-params/5.6.0-M1/junit-jupiter-params-5.6.0-M1.jar!/"
/>
<root
url=
"jar://$MAVEN_REPOSITORY$/org/apiguardian/apiguardian-api/1.1.2/apiguardian-api-1.1.2.jar!/"
/>
<root
url=
"jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-engine/5.6.0-M1/junit-jupiter-engine-5.6.0-M1.jar!/"
/>
<root
url=
"jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-params/5.9.0-M1/junit-jupiter-params-5.9.0-M1.jar!/"
/>
<root
url=
"jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-engine/1.6.0-M1/junit-platform-engine-1.6.0-M1.jar!/"
/>
<root
url=
"jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-engine/5.9.0-M1/junit-jupiter-engine-5.9.0-M1.jar!/"
/>
<root
url=
"jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-engine/1.9.0-M1/junit-platform-engine-1.9.0-M1.jar!/"
/>
</CLASSES>
</CLASSES>
<JAVADOC
/>
<JAVADOC
/>
<SOURCES
/>
<SOURCES
/>
...
...
This diff is collapsed.
Click to expand it.
.idea/libraries/org_javassist_javassist_3_29_2_GA.xml
0 → 100644
View file @
addf2700
<component
name=
"libraryTable"
>
<library
name=
"org.javassist:javassist:3.29.2-GA"
type=
"repository"
>
<properties
maven-id=
"org.javassist:javassist:3.29.2-GA"
/>
<CLASSES>
<root
url=
"jar://$MAVEN_REPOSITORY$/org/javassist/javassist/3.29.2-GA/javassist-3.29.2-GA.jar!/"
/>
</CLASSES>
<JAVADOC
/>
<SOURCES
/>
</library>
</component>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
project02-hangman.iml
View file @
addf2700
...
@@ -13,6 +13,6 @@
...
@@ -13,6 +13,6 @@
<orderEntry
type=
"library"
scope=
"TEST"
name=
"org.hamcrest:hamcrest:2.2"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"TEST"
name=
"org.hamcrest:hamcrest:2.2"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"org.hamcrest:hamcrest-core:2.2"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"org.hamcrest:hamcrest-core:2.2"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"com.github.javaparser:javaparser-core:3.5.12"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"com.github.javaparser:javaparser-core:3.5.12"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"
org.
junit.jupiter
:junit-jupiter:5.6.0-M1
"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"junit.jupiter"
level=
"project"
/>
</component>
</component>
</module>
</module>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
tests/edu/caltech/cs2/project02/EvilHangmanChooserTests.java
View file @
addf2700
...
@@ -126,7 +126,7 @@ public class EvilHangmanChooserTests {
...
@@ -126,7 +126,7 @@ public class EvilHangmanChooserTests {
@DisplayName
(
"Expected makeGuess() exceptions for characters that aren't lower case for EvilHangmanChooser"
)
@DisplayName
(
"Expected makeGuess() exceptions for characters that aren't lower case for EvilHangmanChooser"
)
@Test
@Test
@DependsOn
(
"makeGuess"
)
@DependsOn
(
"makeGuess"
)
public
void
testMakeGuessExceptionsInEvil
()
{
public
void
testMakeGuess
LowercaseChar
ExceptionsInEvil
()
{
Constructor
c
=
Reflection
.
getConstructor
(
EvilHangmanChooser
.
class
,
int
.
class
,
int
.
class
);
Constructor
c
=
Reflection
.
getConstructor
(
EvilHangmanChooser
.
class
,
int
.
class
,
int
.
class
);
EvilHangmanChooser
chooser
=
Reflection
.
newInstance
(
c
,
3
,
1
);
EvilHangmanChooser
chooser
=
Reflection
.
newInstance
(
c
,
3
,
1
);
Method
m
=
Reflection
.
getMethod
(
EvilHangmanChooser
.
class
,
"makeGuess"
,
char
.
class
);
Method
m
=
Reflection
.
getMethod
(
EvilHangmanChooser
.
class
,
"makeGuess"
,
char
.
class
);
...
@@ -134,6 +134,28 @@ public class EvilHangmanChooserTests {
...
@@ -134,6 +134,28 @@ public class EvilHangmanChooserTests {
IntStream
.
range
(
0
,
20
).
forEach
(
i
->
assertThrows
(
IllegalArgumentException
.
class
,
()
->
Reflection
.
invoke
(
m
,
chooser
,
(
char
)
(
'z'
+
(
i
+
1
)))));
IntStream
.
range
(
0
,
20
).
forEach
(
i
->
assertThrows
(
IllegalArgumentException
.
class
,
()
->
Reflection
.
invoke
(
m
,
chooser
,
(
char
)
(
'z'
+
(
i
+
1
)))));
}
}
@Order
(
sanityTestLevel
+
4
)
@DisplayName
(
"Expected makeGuess() exceptions for characters that have been previously guessed for EvilHangmanChooser"
)
@TestDescription
(
"This test makes sure that the makeGuess method throws exceptions for characters that have been guessed previously"
)
@DependsOn
(
"makeGuess"
)
@Test
public
void
testMakeGuessRepeatedCharExceptionsInEvil
()
throws
FileNotFoundException
{
EvilHangmanChooser
chooser
=
new
EvilHangmanChooser
(
5
,
5
);
chooser
.
makeGuess
(
'v'
);
assertThrows
(
IllegalArgumentException
.
class
,
()
->
chooser
.
makeGuess
(
'v'
));
}
@Order
(
sanityTestLevel
+
5
)
@DisplayName
(
"Expected makeGuess() exceptions if no guesses left for EvilHangmanChooser"
)
@TestDescription
(
"This test makes sure that the makeGuess method throws exceptions if number of guesses left is not at least one"
)
@DependsOn
(
"makeGuess"
)
@Test
public
void
testMakeTooManyGuessExceptionsInEvil
()
throws
FileNotFoundException
{
EvilHangmanChooser
chooser
=
new
EvilHangmanChooser
(
22
,
2
);
chooser
.
makeGuess
(
'x'
);
chooser
.
makeGuess
(
'y'
);
assertThrows
(
IllegalStateException
.
class
,
()
->
chooser
.
makeGuess
(
'z'
));
}
}
}
...
...
This diff is collapsed.
Click to expand it.
tests/edu/caltech/cs2/project02/RandomHangmanChooserTests.java
View file @
addf2700
...
@@ -132,13 +132,36 @@ public class RandomHangmanChooserTests {
...
@@ -132,13 +132,36 @@ public class RandomHangmanChooserTests {
@TestDescription
(
"This test makes sure that the makeGuess method throws exceptions for non-lowercase characters"
)
@TestDescription
(
"This test makes sure that the makeGuess method throws exceptions for non-lowercase characters"
)
@DependsOn
(
"makeGuess"
)
@DependsOn
(
"makeGuess"
)
@Test
@Test
public
void
testMakeGuessExceptionsInRandom
()
{
public
void
testMakeGuess
LowercaseChar
ExceptionsInRandom
()
{
Constructor
c
=
Reflection
.
getConstructor
(
RandomHangmanChooser
.
class
,
int
.
class
,
int
.
class
);
Constructor
c
=
Reflection
.
getConstructor
(
RandomHangmanChooser
.
class
,
int
.
class
,
int
.
class
);
RandomHangmanChooser
chooser
=
Reflection
.
newInstance
(
c
,
3
,
1
);
RandomHangmanChooser
chooser
=
Reflection
.
newInstance
(
c
,
3
,
1
);
Method
m
=
Reflection
.
getMethod
(
RandomHangmanChooser
.
class
,
"makeGuess"
,
char
.
class
);
Method
m
=
Reflection
.
getMethod
(
RandomHangmanChooser
.
class
,
"makeGuess"
,
char
.
class
);
IntStream
.
range
(
0
,
20
).
forEach
(
i
->
assertThrows
(
IllegalArgumentException
.
class
,
()
->
Reflection
.
invoke
(
m
,
chooser
,
(
char
)
(
'a'
-
(
i
+
1
)))));
IntStream
.
range
(
0
,
20
).
forEach
(
i
->
assertThrows
(
IllegalArgumentException
.
class
,
()
->
Reflection
.
invoke
(
m
,
chooser
,
(
char
)
(
'a'
-
(
i
+
1
)))));
IntStream
.
range
(
0
,
20
).
forEach
(
i
->
assertThrows
(
IllegalArgumentException
.
class
,
()
->
Reflection
.
invoke
(
m
,
chooser
,
(
char
)
(
'z'
+
(
i
+
1
)))));
IntStream
.
range
(
0
,
20
).
forEach
(
i
->
assertThrows
(
IllegalArgumentException
.
class
,
()
->
Reflection
.
invoke
(
m
,
chooser
,
(
char
)
(
'z'
+
(
i
+
1
)))));
}
}
@Order
(
sanityTestLevel
+
4
)
@DisplayName
(
"Expected makeGuess() exceptions for characters that have been previously guessed for RandomHangmanChooser"
)
@TestDescription
(
"This test makes sure that the makeGuess method throws exceptions for characters that have been guessed previously"
)
@DependsOn
(
"makeGuess"
)
@Test
public
void
testMakeGuessRepeatedCharExceptionsInRandom
()
throws
FileNotFoundException
{
RandomHangmanChooser
chooser
=
new
RandomHangmanChooser
(
5
,
5
);
chooser
.
makeGuess
(
'v'
);
assertThrows
(
IllegalArgumentException
.
class
,
()
->
chooser
.
makeGuess
(
'v'
));
}
@Order
(
sanityTestLevel
+
5
)
@DisplayName
(
"Expected makeGuess() exceptions if no guesses left for RandomHangmanChooser"
)
@TestDescription
(
"This test makes sure that the makeGuess method throws exceptions if number of guesses left is not at least one"
)
@DependsOn
(
"makeGuess"
)
@Test
public
void
testMakeTooManyGuessExceptionsInRandom
()
throws
FileNotFoundException
{
RandomHangmanChooser
chooser
=
new
RandomHangmanChooser
(
22
,
2
);
chooser
.
makeGuess
(
'x'
);
chooser
.
makeGuess
(
'y'
);
assertThrows
(
IllegalStateException
.
class
,
()
->
chooser
.
makeGuess
(
'z'
));
}
}
}
@DisplayName
(
"Complete Functionality Tests"
)
@DisplayName
(
"Complete Functionality Tests"
)
@TestMethodOrder
(
MethodOrderer
.
OrderAnnotation
.
class
)
@TestMethodOrder
(
MethodOrderer
.
OrderAnnotation
.
class
)
...
...
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