@Test
public void checkInputFormat() throws IOException, InterruptedException {

    Configuration conf = new Configuration(false);
    conf.set("fs.default.name", "file:///");
    conf.set("nl.basjes.parse.apachehttpdlogline.format", logformat);
    // A ',' separated list of fields
    conf.set("nl.basjes.parse.apachehttpdlogline.fields",
        "TIME.EPOCH:request.receive.time.epoch," +
        "HTTP.USERAGENT:request.user-agent");
    File testFile = new File("src/test/resources/access.log");
    Path path = new Path(testFile.getAbsoluteFile().toURI());
    FileSplit split = new FileSplit(path, 0, testFile.length(), null);
    InputFormat inputFormat = ReflectionUtils.newInstance(ApacheHttpdLogfileInputFormat.class, conf);
    TaskAttemptContext context = new TaskAttemptContextImpl(conf, new TaskAttemptID());
    RecordReader reader = inputFormat.createRecordReader(split, context);
    reader.initialize(split, context);
    assertTrue(reader.nextKeyValue());
    Object value = reader.getCurrentValue();
    if (value instanceof ParsedRecord) {
        assertEquals("1483272081000", ((ParsedRecord) value).getString("TIME.EPOCH:request.receive.time.epoch"));
        assertEquals("Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36",
            ((ParsedRecord) value).getString("HTTP.USERAGENT:request.user-agent"));
    } else {
        fail("Wrong return class type");
    }
}