};
for (int i = 0; i < files.length; i += 3) {
byte[] body = Files.toByteArray(new File(files[i+0]));
ListMultimap<String, Object> emptyMap = ArrayListMultimap.create();
Record event = createEvent(new ByteArrayInputStream(body), emptyMap);
assertEquals(files[i+1], detect(event, false));
}
for (int i = 0; i < files.length; i += 3) {
byte[] body = Files.toByteArray(new File(files[i+0]));
ListMultimap headers = ImmutableListMultimap.of(Fields.ATTACHMENT_NAME, new File(files[i+0]).getName());
Record event = createEvent(new ByteArrayInputStream(body), headers);
assertEquals(files[i+2], detect(event, true));
}
for (int i = 0; i < files.length; i += 3) {
byte[] body = Files.toByteArray(new File(files[i+0]));
ListMultimap headers = ImmutableListMultimap.of(Fields.ATTACHMENT_NAME, new File(files[i+0]).getPath());
Record event = createEvent(new ByteArrayInputStream(body), headers);
assertEquals(files[i+2], detect(event, true));
}
// test excludeParameters flag:
boolean excludeParameters = true;
byte[] body = Files.toByteArray(new File(path + "/testWindows-x86-32.exe"));
ListMultimap headers = ImmutableListMultimap.of(Fields.ATTACHMENT_NAME, new File(path + "/testWindows-x86-32.exe").getPath());
Record event = createEvent(new ByteArrayInputStream(body), headers);
assertEquals("application/x-msdownload", detect(event, true, excludeParameters));
}