LdapUserService implements UserService { @Override public String create(User user) throws UserException { throw new UnsupportedOperationException("LdapUserService does not implement Create."); } LdapUserService(Config config);  LdapUserService(DirContext context, String[] userAttributes); @Override String create(User user); @Override void delete(String userName); @Override User getUser(String userName); @Override String retrieve(Properties properties); @Override void update(String userName, User user);  }
@Test(expected = UnsupportedOperationException.class) public void testCreateMethod() throws UserException, NamingException { DirContext ctx = mock(InitialDirContext.class); String[] userAttributes = mockUserAttributes(); LdapUserService lus = new LdapUserService(ctx, userAttributes); lus.create(mockUser()); }