-
Notifications
You must be signed in to change notification settings - Fork 7
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
Fix incorrect file name regex logic #21
Changes from 2 commits
c8bc216
790d4f6
9eb5223
68d3969
d7a1d5c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.softwarementors.extjs.djn.jscodegen; | ||
dbradicich marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
import org.testng.annotations.Test; | ||
|
||
import java.lang.reflect.Method; | ||
|
||
import static org.testng.Assert.*; | ||
|
||
public class CodeFileGeneratorTest { | ||
|
||
private String getDebugFileName(String file) { | ||
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'd just make 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 was confused because I didn't know the test rules of the project, but it's good that I can use protected function. 👍 |
||
try { | ||
Method method = CodeFileGenerator.class.getDeclaredMethod("getDebugFileName", String.class); | ||
method.setAccessible(true); | ||
Object result = method.invoke(null, file); | ||
return (String) result; | ||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
return ""; | ||
} | ||
} | ||
|
||
@Test | ||
public void getDebugFileNameTest() { | ||
assertEquals( | ||
"john.jspiner", | ||
getDebugFileName("john.jspiner") | ||
); | ||
assertEquals( | ||
"app-debug.js", | ||
getDebugFileName("app.js") | ||
); | ||
} | ||
} |
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.
file.replaceFirst(".js$", "-debug.js");
might be a better way to express 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.
Much better! 👍
Applied in 9eb5223