fixed path referencing a test resource file

This commit is contained in:
Claudio Atzori 2020-03-25 15:21:46 +01:00
parent 51d0c9bdd7
commit f441f823dd
1 changed files with 3 additions and 19 deletions

View File

@ -13,12 +13,12 @@ import java.util.stream.Collectors;
public class MergeAuthorTest { public class MergeAuthorTest {
List<Publication> publicationsToMerge; private List<Publication> publicationsToMerge;
final ObjectMapper mapper = new ObjectMapper(); private final ObjectMapper mapper = new ObjectMapper();
@Before @Before
public void setUp() throws Exception { public void setUp() throws Exception {
final String json = IOUtils.toString(this.getClass().getResourceAsStream("/eu/dnetlib/dedup/json/authors_merge.json")); final String json = IOUtils.toString(this.getClass().getResourceAsStream("/eu/dnetlib/dhp/dedup/json/authors_merge.json"));
publicationsToMerge = Arrays.asList(json.split("\n")).stream().map(s-> { publicationsToMerge = Arrays.asList(json.split("\n")).stream().map(s-> {
@ -28,34 +28,18 @@ public class MergeAuthorTest {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
}).collect(Collectors.toList()); }).collect(Collectors.toList());
} }
@Test @Test
public void test() throws Exception { public void test() throws Exception {
Publication dedup = new Publication(); Publication dedup = new Publication();
publicationsToMerge.forEach(p-> { publicationsToMerge.forEach(p-> {
dedup.mergeFrom(p); dedup.mergeFrom(p);
dedup.setAuthor(DedupUtility.mergeAuthor(dedup.getAuthor(),p.getAuthor())); dedup.setAuthor(DedupUtility.mergeAuthor(dedup.getAuthor(),p.getAuthor()));
}); });
System.out.println(mapper.writeValueAsString(dedup)); System.out.println(mapper.writeValueAsString(dedup));
} }
} }