@Test public void testAesEncryption() { String masterPassword = "BigMasterPassowrd!!!"; String secret = "some secret to encrypt"; String[] args = new String[] {"aes", masterPassword, secret}; Main.EncryptionCliProcessor ecp = new Main.EncryptionCliProcessor(); ecp.parse(args); assertEquals(Main.Algorithm.aes, ecp.getAlgorithm()); assertEquals(masterPassword, ecp.getMasterPassword()); assertEquals(secret, ecp.getSecret()); String encrypted = ecp.encrypt(); assertAll( () -> assertThat("Encrypted string should contain aes prefix: " + encrypted, encrypted.startsWith(EncryptionFilter.PREFIX_GCM)), () -> assertThat("Encrypted string should contain suffix \"}\": " + encrypted, encrypted.endsWith("}")) ); String orig = EncryptionUtil.decryptAes(ecp.getMasterPassword().toCharArray(), encrypted.substring(EncryptionFilter.PREFIX_GCM.length(), encrypted.length() - 1)); assertEquals(secret, orig); Main.main(args); }
private Main() { throw new IllegalStateException("Main class"); }
Main { private Main() { throw new IllegalStateException("Main class"); } }
Main { private Main() { throw new IllegalStateException("Main class"); } private  Main(); }
Main { private Main() { throw new IllegalStateException("Main class"); } private  Main(); static void main(String[] args); }
Main { private Main() { throw new IllegalStateException("Main class"); } private  Main(); static void main(String[] args);  }