@Test public void testReadAlterAttributes() { final OracleAttributesReader reader = new OracleAttributesReader(TestHelpers.createDummyMessages()); OracleUserAttributes.Builder caAttributes = new OracleUserAttributes.Builder(); caAttributes.setUserName("testUser"); Set<Attribute> attributes = new HashSet<Attribute>(); attributes.add( AttributeBuilder.build( OracleConstants.ORACLE_AUTHENTICATION_ATTR_NAME, OracleConstants.ORACLE_AUTH_LOCAL)); attributes.add(AttributeBuilder.buildPassword("myPassword".toCharArray())); reader.readAlterAttributes(AttributeUtil.toMap(attributes), caAttributes); Assert.assertEquals(OracleAuthentication.LOCAL, caAttributes.getAuth()); Assert.assertNotNull("Password must not be null", caAttributes.getPassword()); // verify that password is not set for alter when not set caAttributes = new OracleUserAttributes.Builder(); caAttributes.setUserName("testUser"); attributes.clear(); attributes.add(AttributeBuilder.buildPasswordExpired(true)); reader.readAlterAttributes(AttributeUtil.toMap(attributes), caAttributes); Assert.assertNull("Password must be null", caAttributes.getPassword()); // try to update authentication to null attributes = new HashSet<Attribute>(); attributes.add(AttributeBuilder.build(OracleConstants.ORACLE_AUTHENTICATION_ATTR_NAME)); attributes.add(AttributeBuilder.buildPassword("myPassword".toCharArray())); try { reader.readAlterAttributes(AttributeUtil.toMap(attributes), caAttributes); fail("Create attributes must fail for null authentication"); } catch (IllegalArgumentException e) { } }