Skip to content
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

Merged
merged 12 commits into from
Aug 28, 2017
Merged

API Tests #143

merged 12 commits into from
Aug 28, 2017

Conversation

AustinShalit
Copy link
Member

No description provided.

@AustinShalit AustinShalit added the work in progress A pull request that is still a work-in-progress and should not be merged label Aug 12, 2017
@AustinShalit
Copy link
Member Author

@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!");
Copy link
Contributor

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.

Copy link
Member Author

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

Copy link
Contributor

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?

Copy link
Member

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"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems unused?

Copy link
Member Author

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~"})
Copy link
Contributor

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.

@nightpool nightpool changed the title API Tests [WIP] API Tests Aug 12, 2017
@AustinShalit
Copy link
Member Author

On hold until #144 is solved


@Test
public void isEqualInvalidPrimativeTest() {
assertThrows(UnsupportedOperationException.class, () -> EqualityUtils.isEqual(new long[0], new long[0]));
Copy link
Member Author

@AustinShalit AustinShalit Aug 17, 2017

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?


public UtilityClassTest(Class<T> clazz) {
this.clazz = clazz;
}
Copy link
Member

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());
Copy link
Member

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();
});
Copy link
Member

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.

"-Dtestfx.robot=glass",
"-Dtestfx.headless=true",
"-Dprism.order=sw",
"-Dprism.text=t2k"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation changes?

Copy link
Member Author

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?

Copy link
Member

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

@codecov-io
Copy link

Codecov Report

Merging #143 into master will increase coverage by 3.5%.
The diff coverage is 100%.

@@             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

@AustinShalit AustinShalit changed the title [WIP] API Tests API Tests Aug 25, 2017
@AustinShalit
Copy link
Member Author

@nightpool I'd like to merge this PR and then open another one with more progress. That way we have coverage for PRs.

)
}
}
}
Copy link
Member

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?

Copy link
Member

@JLLeitschuh JLLeitschuh left a 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!

@AustinShalit AustinShalit merged commit ea2581c into wpilibsuite:master Aug 28, 2017
@AustinShalit AustinShalit deleted the tests branch August 28, 2017 18:34
@@ -48,6 +49,7 @@ public void testColorWhenFalse() {
}

@Test
@Disabled
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
work in progress A pull request that is still a work-in-progress and should not be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants