-
Notifications
You must be signed in to change notification settings - Fork 2
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
Fixture twins #85
Fixture twins #85
Conversation
private boolean isYml(Path path) { | ||
return Stream | ||
.of(YAML_EXT, YML_EXT) | ||
.anyMatch(ext -> getFileName(path).endsWith(ext)); |
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.
👍
<Match> | ||
<Class name="com.github.vkorobkov.jfixtures.util.StringUtil"/> | ||
<Bug pattern="NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE"/> | ||
</Match> | ||
<Match> | ||
<Class name="com.github.vkorobkov.jfixtures.loader.FixturesLoader"/> | ||
<Bug pattern="NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE"/> |
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.
Can we make this rule global?
} | ||
|
||
private Fixture loadFixture(Path file) { | ||
String name = getFixtureName(file); | ||
val name = getFixtureName(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 change does not concern the feature, so I'd remove it. Besides that, we probably don't have to always use val
. We can leave simple and short types as they are. val
is good for hiding long types and types with generics
@@ -149,6 +149,44 @@ class FixturesLoaderTest extends Specification implements YamlVirtualFolder { | |||
role.columns.version == new FixtureValue(1) | |||
} | |||
|
|||
def "should use yaml config"() { |
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 "config"? What about "#load consumes fixture with .yaml extension"
?
@rodionovsasha this is the last part of the future - should update version in |
String separator = file.getFileSystem().getSeparator(); | ||
String relativePath = Paths.get(path).relativize(file).toString(); | ||
relativePath = relativePath.substring(0, relativePath.lastIndexOf(".yml")); | ||
val separator = file.getFileSystem().getSeparator(); |
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.
Let's keep using types instead of val
when types are short and don't have generics?
dima.columns.age == new FixtureValue(28) | ||
} | ||
|
||
def "load throws when config exists with yaml and yml extensions"() { |
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.
"#load throws when a yaml fixture has a twin"
e.message == "Fixture exists with both extensions(yaml/yml)." | ||
} | ||
|
||
def "load throws when config exists with yml and yaml extensions"() { |
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 test is redundant since the test above does the same. The order(yaml+yml VS yml+yaml) does not matter in this place, probably
<Bug pattern="DM_CONVERT_CASE"/> | ||
</Match> | ||
<Match> | ||
<Class name="com.github.vkorobkov.jfixtures.config.structure.tables.CleanMethod"/> |
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.
👍
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 description provided.