    @Test
    public void testVersion() {

        final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        HdfsFSImageTool.out = new PrintStream(byteArrayOutputStream);
        HdfsFSImageTool.err = HdfsFSImageTool.out;

        HdfsFSImageTool.run(new String[]{"-V"});

        Pattern pattern = Pattern.compile("Version 1\\..*\n" +
                "Build timestamp 20.*\n" +
                "SCM Version .*\n" +
                "SCM Branch .*\n");
        assertThat(byteArrayOutputStream.toString())
                .matches(pattern);
    }