当我在 angular 2 中运行测试时,我在 Coverage Summary 部分的控制台命令上看到一些关键字输出为Statements, Branches, Functions....
我不知道到底是什么?
任何帮助为我解释这一点,谢谢。
我从 spring 签出了这个项目: https ://github.com/spring-guides/gs-batch-processing
来源: https: //spring.io/guides/gs/batch-processing/
我将“sample-data.csv”中的“,”替换为“tab”:
Jill Doe
Joe Doe
Justin Doe
Jane Doe
John Doe
Run Code Online (Sandbox Code Playgroud)
然后我将新的分隔符添加到阅读器:
@Bean
public FlatFileItemReader<Person> reader() {
return new FlatFileItemReaderBuilder<Person>()
.name("personItemReader")
.resource(new ClassPathResource("sample-data.csv"))
.delimited()
.delimiter(DelimitedLineTokenizer.DELIMITER_TAB) // NEW DELIMITER
.names(new String[]{"firstName", "lastName"})
.fieldSetMapper(new BeanWrapperFieldSetMapper<Person>() {{
setTargetType(Person.class);
}})
.build();
}
Run Code Online (Sandbox Code Playgroud)
当我启动时,我收到此错误:
Caused by: org.springframework.batch.item.file.transform.IncorrectTokenCountException: Incorrect number of tokens found in record: expected 2 actual 1
at org.springframework.batch.item.file.transform.AbstractLineTokenizer.tokenize(AbstractLineTokenizer.java:142) ~[spring-batch-infrastructure-4.0.1.RELEASE.jar:4.0.1.RELEASE]
at org.springframework.batch.item.file.mapping.DefaultLineMapper.mapLine(DefaultLineMapper.java:43) ~[spring-batch-infrastructure-4.0.1.RELEASE.jar:4.0.1.RELEASE]
at org.springframework.batch.item.file.FlatFileItemReader.doRead(FlatFileItemReader.java:180) ~[spring-batch-infrastructure-4.0.1.RELEASE.jar:4.0.1.RELEASE]
... 50 common frames omitted
Run Code Online (Sandbox Code Playgroud)
我尝试过使用“@”分隔符 - >它有效。由于某种原因,我无法使其与制表符分隔符一起使用......
当然,在我的实际项目中,我有一个带有“制表符”分隔符的输入文件......
这里有什么解决办法吗?
我使用VueJS编码前端,加载图像时标签出现问题。
Template
<div class="items" transition="fade" v-for="item in list">
<img :src="item.logoPath" @error="replaceByDefault">
</div>
JS(ES6)
export default {
methods: {
replaceByDefault(e) {
// code here to replace image by default
}
}
template: require('./template.html')
}
Run Code Online (Sandbox Code Playgroud)
目前,我已经在replaceByDefault函数中进行了调试,但是没有运行到该函数中吗?不知道为什么
您能帮我解释一下这个问题吗?谢谢!
我正在尝试创建有关照片列表的示例,并且在调用API之后将数据绑定到组件时遇到麻烦。
JS代码:
<script>
// photo item
Vue.component('photo-item', {
props: ['photo'],
template: `<li>{{ photo.name }}</li>`
});
// List of photos
Vue.component('photo-list', {
props: ['photos'],
template: `
<ul id="photo-list">
<photo-item v-for="photo in photos" :photo="photo"></photo-item>
</ul>`
});
new Vue({
el: "#photo_detail",
data: {
photos: []
},
created: function() {
axios
.get('/api/photos')
.then(function (response) {
this.photos = response.data; // Data existed
})
.catch(function (err) {
console.log(err);
});
}
})
</script>
Run Code Online (Sandbox Code Playgroud)
HTML代码
<main id="photo_detail">
<photo-list v-for="photo in photos" :photo="photo"></photo-list>
</main>
Run Code Online (Sandbox Code Playgroud)
从API获取所有照片后,据我了解,该变量photos将自动绑定,而VueJS将更新DOM。
VueJs 2.1.6 …
javascript ×2
vue.js ×2
angular ×1
java ×1
spring ×1
spring-batch ×1
unit-testing ×1
vuejs2 ×1