@Override
      protected void configure() {
        bind(EntityManager.class).toInstance(mockEntityManager);
        bind(DBAccessor.class).toInstance(createMock(DBAccessor.class));
        bind(OsFamily.class).toInstance(createNiceMock(OsFamily.class));
        bind(UserDAO.class).toInstance(mockUserDao);
        bind(MemberDAO.class).toInstance(createMock(MemberDAO.class));
        bind(PrivilegeDAO.class).toInstance(createMock(PrivilegeDAO.class));
        bind(HookService.class).toInstance(createMock(HookService.class));
        bind(HookContextFactory.class).toInstance(createMock(HookContextFactory.class));
        bind(PrincipalDAO.class).toInstance(createMock(PrincipalDAO.class));
        bind(new TypeLiteral<Encryptor<AmbariServerConfiguration>>() {}).annotatedWith(Names.named("AmbariServerConfigurationEncryptor")).toInstance(Encryptor.NONE);
        bind(AmbariLdapConfigurationProvider.class).toInstance(createMock(AmbariLdapConfigurationProvider.class));

        PasswordEncoder nopEncoder = createMock(PasswordEncoder.class);
        expect(nopEncoder.matches(anyString(), anyString())).andAnswer(
                () -> Objects.equals(EasyMock.getCurrentArguments()[0], EasyMock.getCurrentArguments()[1])).anyTimes();
        expect(nopEncoder.encode(anyString())).andAnswer(
                () -> (String)EasyMock.getCurrentArguments()[0]).anyTimes();
        bind(PasswordEncoder.class).toInstance(nopEncoder);

        Configuration noConfig = createMock(Configuration.class);
        expect(noConfig.getPasswordPolicyHistoryCount()).andReturn(3).anyTimes();
        expect(noConfig.getPasswordPolicyRegexp()).andReturn(".*").anyTimes();
        bind(Configuration.class).toInstance(noConfig);
      }
User creation should throw {@link AmbariException} in case another user exists with the same name but
different user type.
ambari-server/src/test/java/org/apache/ambari/server/security/authorization/UsersTest.java