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-23wi
project04
Commits
8e4ae954
Commit
8e4ae954
authored
2 years ago
by
Adam Blank
Browse files
Options
Download
Email Patches
Plain Diff
Add better error message to failure based on accidental public method.
parent
68cf02e8
master
No related merge requests found
Pipeline
#77290
failed with stage
in 0 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/edu/caltech/cs2/interfaces/IStyleTests.java
+15
-9
tests/edu/caltech/cs2/interfaces/IStyleTests.java
with
15 additions
and
9 deletions
+15
-9
tests/edu/caltech/cs2/interfaces/IStyleTests.java
View file @
8e4ae954
...
@@ -131,16 +131,22 @@ public interface IStyleTests {
...
@@ -131,16 +131,22 @@ public interface IStyleTests {
}
}
if
(
Modifier
.
isPublic
(
m
.
getModifiers
()))
{
if
(
Modifier
.
isPublic
(
m
.
getModifiers
()))
{
for
(
int
i
=
0
;
i
<
100
;
i
++)
{
try
{
if
(
m
.
getParameterCount
()
==
0
)
{
for
(
int
i
=
0
;
i
<
100
;
i
++)
{
m
.
invoke
(
o
);
if
(
m
.
getParameterCount
()
==
0
)
{
}
else
if
(
m
.
getParameterCount
()
==
1
)
{
m
.
invoke
(
o
);
Class
<?>[]
clazes
=
m
.
getParameterTypes
();
}
else
if
(
m
.
getParameterCount
()
==
1
)
{
m
.
invoke
(
o
,
getArg
(
clazes
[
0
]));
Class
<?>[]
clazes
=
m
.
getParameterTypes
();
}
else
if
(
m
.
getParameterCount
()
==
2
)
{
m
.
invoke
(
o
,
getArg
(
clazes
[
0
]));
Class
<?>[]
clazes
=
m
.
getParameterTypes
();
}
else
if
(
m
.
getParameterCount
()
==
2
)
{
m
.
invoke
(
o
,
getArg
(
clazes
[
0
]),
getArg
(
clazes
[
1
]));
Class
<?>[]
clazes
=
m
.
getParameterTypes
();
m
.
invoke
(
o
,
getArg
(
clazes
[
0
]),
getArg
(
clazes
[
1
]));
}
}
}
}
catch
(
IllegalArgumentException
e
)
{
System
.
out
.
println
(
"You have a method that should be private that is public."
);
System
.
out
.
println
(
"Take a look at your method: "
+
m
);
throw
e
;
}
}
}
}
assertTrue
(
NewMe
.
NUM_CALLS
==
0
,
"Calls to "
+
m
.
getName
()
+
" should not create a new instance of "
+
getClazz
().
getName
());
assertTrue
(
NewMe
.
NUM_CALLS
==
0
,
"Calls to "
+
m
.
getName
()
+
" should not create a new instance of "
+
getClazz
().
getName
());
...
...
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