-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API Tests #143
API Tests #143
Conversation
@JLLeitschuh Is there something I can do better with the build files? |
@@ -26,6 +26,7 @@ | |||
private static final Pattern newMetadataPattern = Pattern.compile("/\\."); | |||
|
|||
private NetworkTableUtils() { | |||
throw new UnsupportedOperationException("This is a utility class!"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the private constructor is sufficient here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This prevents instantiation from reflection
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we care if someone instantiates with reflection?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It prevents instantiation from within the class. Useful from a maintainability standpoint
build.gradle.kts
Outdated
fun testFx(name: String, version: String = "4.0.+") = | ||
create(group = "org.testfx", name = name, version = version) | ||
"testCompile"(testFx(name = "testfx-core")) | ||
"testCompile"(testFx(name = "testfx-junit5")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems unused?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Going to be used once this PR is not WIP.
"false, /my.key.with.dots", | ||
"false, /my~key~with~tildes~", | ||
"false, /~my~keywithtildes", | ||
"false, /~metadata~with~tildes~"}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this line is an edge case and I don't want to decide on it either way.
On hold until #144 is solved |
e4a29ca
to
80e6b88
Compare
|
||
@Test | ||
public void isEqualInvalidPrimativeTest() { | ||
assertThrows(UnsupportedOperationException.class, () -> EqualityUtils.isEqual(new long[0], new long[0])); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SamCarlberg Are long arrays something EqualityUtils.isEqual()
should support?
0e3d28e
to
20ba46e
Compare
|
||
public UtilityClassTest(Class<T> clazz) { | ||
this.clazz = clazz; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could simplify this constructor by removing the constructor argument and doing this instead:
public UtilityClassTest() {
this.clazz = (new TypeToken<T>(getClass()) {}).getRawType();
}
public void testConstructorPrivate() throws NoSuchMethodException { | ||
Constructor<T> constructor = clazz.getDeclaredConstructor(); | ||
|
||
assertFalse(constructor.isAccessible()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A message would be useful here.
Constructor<T> constructor = clazz.getDeclaredConstructor(); | ||
constructor.setAccessible(true); | ||
constructor.newInstance(); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A message would be useful here.
app/app.gradle.kts
Outdated
"-Dtestfx.robot=glass", | ||
"-Dtestfx.headless=true", | ||
"-Dprism.order=sw", | ||
"-Dprism.text=t2k" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think my IDE and @SamCarlberg's IDE are fighting over the indentation of this file. Will #146 fix this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, the indentation rule isn't correctly implemented yet.
pinterest/ktlint#76
1b233e5
to
f793c0b
Compare
Codecov Report
@@ Coverage Diff @@
## master #143 +/- ##
===========================================
+ Coverage 13.21% 16.71% +3.5%
- Complexity 187 246 +59
===========================================
Files 136 136
Lines 3549 3547 -2
Branches 272 272
===========================================
+ Hits 469 593 +124
+ Misses 3048 2923 -125
+ Partials 32 31 -1 |
@nightpool I'd like to merge this PR and then open another one with more progress. That way we have coverage for PRs. |
api/api.gradle.kts
Outdated
) | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not move this logic to the root build.gradle.kts
file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good. Nice set of changes!
@@ -48,6 +49,7 @@ public void testColorWhenFalse() { | |||
} | |||
|
|||
@Test | |||
@Disabled |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A reason would have been helpful here.
No description provided.