-
Notifications
You must be signed in to change notification settings - Fork 28
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
Allow for moving truncation into the implementing API #68
Changes from 1 commit
46ff97c
034e114
32263c4
5fa067d
a320167
e92aa81
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,9 +16,9 @@ | |
class ArchitectureTest { | ||
@ArchTest | ||
static final ArchRule NO_JENKINS_INSTANCE_CALL = PluginArchitectureRules.NO_JENKINS_INSTANCE_CALL; | ||
|
||
@ArchTest | ||
static final ArchRule NO_PUBLIC_TEST_CLASSES = PluginArchitectureRules.NO_PUBLIC_TEST_CLASSES; | ||
// Todo: this seems to prevent paramteized non-integration tests. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So I know that I'm using a Junit4 style test here, but that's because the parametrized options for Junit5 seem to require a huge amount of repetitive boilerplate for this kind of use-case. It seems easy enough to fix this rule upstream to permit Junit4 style tests: /** Junit 5 test classes should not be public. */
public static final ArchRule NO_PUBLIC_TEST_CLASSES =
noClasses().that().haveSimpleNameEndingWith("Test")
.and().haveSimpleNameNotContaining("_jmh")
.and().doNotHaveModifier(JavaModifier.ABSTRACT)
+ .and().areNotAnnotatedWith(RunWith.class)
.and().haveSimpleNameNotEndingWith("ITest")
.should().bePublic(); if that's deemed acceptable? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @uhafner I'd appreciate your input on this, as you're down as the author of these rules. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm fine with using JUnit 4 in this module. It would be simpler if you would just inline the rule here and adapt it accordingly (or remove it completely). |
||
// @ArchTest | ||
// static final ArchRule NO_PUBLIC_TEST_CLASSES = PluginArchitectureRules.NO_PUBLIC_TEST_CLASSES; | ||
|
||
@ArchTest | ||
static final ArchRule NO_TEST_API_CALLED = ArchitectureRules.NO_TEST_API_CALLED; | ||
|
This file was deleted.
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 logic here is a little bit hard to understand at a start (I even left a comment first asking why we want a reversed output), since it requires you to understand the implementation of the joiner first and the join method in reverse acknowledges this special case. So, although the joiner is just an embedded class, adding another field (e.g.
reverse
) and set it identical totruncateStart
makes it easier to understand IMO.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.
Yes, I agree that it's a bit manky. I think part of the problem is that we reverse it in two different places. I think I should be able to refactor it so that the
Joiner
just retuns a plain list of strings and we do the reversal at the end - so the joiner doesn't need to know about reverse; although I'm not sure if that can be done without also moving the truncation text to the start. Would that make more sense? I think it might... so shouldTruncated to three lines would come out in reverse come out as
or
I'm thinking possibly the latter.