@Test(expected = IllegalStateException.class) public void testMissingPropertiesParsing() { Properties testProperties = new Properties(); testProperties.put(CommandLineDriverSettingsModule.PRINCIPAL_KEY, "aurora-scheduler"); ByteArrayOutputStream propertiesStream = new ByteArrayOutputStream(); try { testProperties.store(propertiesStream, ""); } catch (IOException e) { throw Throwables.propagate(e); } CommandLineDriverSettingsModule.parseCredentials( new ByteArrayInputStream(propertiesStream.toByteArray())); }
@Test public void testPropertiesParsing() { Properties testProperties = new Properties(); testProperties.put(CommandLineDriverSettingsModule.PRINCIPAL_KEY, "aurora-scheduler"); testProperties.put(CommandLineDriverSettingsModule.SECRET_KEY, "secret"); ByteArrayOutputStream propertiesStream = new ByteArrayOutputStream(); try { testProperties.store(propertiesStream, ""); } catch (IOException e) { throw Throwables.propagate(e); } assertEquals( testProperties, CommandLineDriverSettingsModule.parseCredentials( new ByteArrayInputStream(propertiesStream.toByteArray()))); }