-
Notifications
You must be signed in to change notification settings - Fork 238
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
add xlsDataSetLoader #148
base: master
Are you sure you want to change the base?
add xlsDataSetLoader #148
Conversation
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.
In addition to the inline comments, was there a reason to rename the context file?
@@ -7,3 +7,9 @@ bin | |||
.DS_Store | |||
.idea | |||
*.iml | |||
*.ipr | |||
*.iws | |||
*/*.iml |
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.
Already covered by *.iml
*/*.iml |
*.ipr | ||
*.iws | ||
*/*.iml | ||
*/*.iws |
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.
Already covered by *.iws
*/*.iws |
*.iws | ||
*/*.iml | ||
*/*.iws | ||
*/*.ipr |
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.
Already covered by *.ipr
*/*.ipr |
@@ -18,7 +18,7 @@ | |||
import com.github.springtestdbunit.sample.entity.Person; | |||
|
|||
@RunWith(SpringJUnit4ClassRunner.class) | |||
@ContextConfiguration | |||
@ContextConfiguration({"classpath:com/github/springtestdbunit/sample/service/applicationContext.xml"}) |
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 does the existing configuration need to be changed?
@ContextConfiguration({"classpath:com/github/springtestdbunit/sample/service/applicationContext.xml"}) | |
@ContextConfiguration |
assertEquals(1, personList.size()); | ||
assertEquals("wu", personList.get(0).getLastName()); | ||
} | ||
|
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.
Please also test testRemove() to be consistent with the above test class.
public class XlsDataSetLoader extends AbstractDataSetLoader { | ||
|
||
@Override | ||
protected IDataSet createDataSet(Resource resource) throws Exception { |
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.
protected IDataSet createDataSet(Resource resource) throws Exception { | |
protected IDataSet createDataSet(final Resource resource) throws Exception { |
import java.io.InputStream; | ||
|
||
/** | ||
* Created by yangjianzhou on 17-11-18. |
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.
* Created by yangjianzhou on 17-11-18. | |
* {@link com.github.springtestdbunit.dataset.DataSetLoader DataSetLoader} for Excel (.xls) files. | |
* | |
* Created by yangjianzhou on 17-11-18. |
import static org.junit.Assert.assertEquals; | ||
|
||
@RunWith(SpringJUnit4ClassRunner.class) | ||
@ContextConfiguration({"classpath:com/github/springtestdbunit/sample/service/applicationContext.xml"}) |
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.
@ContextConfiguration({"classpath:com/github/springtestdbunit/sample/service/applicationContext.xml"}) | |
@ContextConfiguration |
XLS support added in a maintained repository: https://github.com/ppodgorsek/spring-test-dbunit |
1 . update .gitignore and ignore .iml . ipr and so on
2 . add xlsDataSetLoader and test it where XlsDataSetLoaderTest