public File saveSecret(String filename) throws IOException
    {
        return secretConfig().save(filename);
    }
@Test
    public void testSaveSecret() throws IOException
    {
        ZCert cert = new ZCert("uYax]JF%mz@r%ERApd<h]pkJ/Wn//lG!%mQ>Ob3U", "!LeSNcjV%qv!apmqePOP:}MBWPCHfdY4IkqO=AW0");
        cert.setMeta("version", "1");

        StringWriter writer = new StringWriter();
        cert.saveSecret(writer);

        String datePattern = "[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}[+-]?[0-9]{4}";
        String expected = "# \\*\\* Generated on " + datePattern + " by ZCert \\*\\*\n" +
                "#    ZeroMQ CURVE \\*\\*Secret\\*\\* Certificate\n" +
                "#    DO NOT PROVIDE THIS FILE TO OTHER USERS nor change its permissions.\n\n" +
                "metadata\n" +
                "    version = \"1\"\n" +
                "curve\n" +
                "    secret-key = \"!LeSNcjV%qv!apmqePOP:}MBWPCHfdY4IkqO=AW0\"\n" +
                "    public-key = \"uYax]JF%mz@r%ERApd<h]pkJ/Wn//lG!%mQ>Ob3U\"\n";
        String result = writer.toString();

        assertThat(Pattern.compile(expected).matcher(result).matches(), is(true));
    }