Skip to content

Commit

Permalink
1. Reinstate missing imports to ZooKeeperMain.
Browse files Browse the repository at this point in the history
2. Add unit tests for CommandFactory.
3. Remove redundant import from CommandFactory.
  • Loading branch information
jonomorris committed Feb 20, 2020
1 parent ed76f14 commit 4957d89
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
import org.apache.zookeeper.admin.ZooKeeperAdmin;
import org.apache.zookeeper.cli.CliCommand;
import org.apache.zookeeper.cli.CommandFactory;
import org.apache.zookeeper.cli.CommandNotFoundException;
import org.apache.zookeeper.cli.CliException;
import org.apache.zookeeper.cli.MalformedCommandException;
import org.apache.zookeeper.client.ZKClientConfig;
import org.apache.zookeeper.server.ExitCode;
import org.apache.zookeeper.util.ServiceUtils;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package org.apache.zookeeper.cli;

import org.apache.zookeeper.server.admin.Command;

import java.util.function.Supplier;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package org.apache.zookeeper.cli;

import static org.junit.Assert.assertTrue;
import org.junit.Test;

/**
* Unit test for {@link CommandFactory}.
*/
public class CommandFactoryTest {

/**
* Verify that the {@code CommandFactory} can create a command instance.
*/
@Test
public void testCommandCreation() {
CliCommand cliCommand =
CommandFactory.getInstance(CommandFactory.Command.CREATE);
assertTrue(cliCommand instanceof CreateCommand);
}
}

0 comments on commit 4957d89

Please sign in to comment.