/** * Cmd_ lu diff. * * @throws InvalidElementException the invalid element exception */ @Test public void cmd_LUDiff() throws InvalidElementException { // Setup Differential Calculation. final LogicalUnit lu = this.stage.getLogicalUnit("aCard1"); lu.getContents().addElement(new Artifact(TH.w1File)); lu.commit("Scott", "Differential Commit."); TH.writeFile(TH.w1File, "Line 1 Content.\nLine 2 Content.\n\nLine 4 Content."); this.cmd = new LUCmdDiff(this.stage, "aCard1", "c1File.txt"); Assert.assertTrue("Should Succeed.", this.cmd.execute()); this.cmd = new LUCmdDiff(this.stage); Assert.assertFalse("Should Not Succeed.", this.cmd.execute()); // Check Acceptable Assert.assertTrue( "Doesn't Accept 'ludiff aCard -e c1File.txt'.", this.cmd.accepts("ludiff aCard -e c1File.txt")); Assert.assertTrue( "Doesn't Accept 'ludiff -e c1File.txt'.", this.cmd.accepts("ludiff -e c1File.txt")); Assert.assertTrue("Doesn't Accept 'ludiff -e a b c'.", this.cmd.accepts("ludiff -e a b c")); Assert.assertTrue( "Doesn't Accept 'ludiff x y z -e a b c'.", this.cmd.accepts("ludiff x y z -e a b c")); Assert.assertTrue( "Doesn't Accept 'ludiff x y z -e a/b/c/'.", this.cmd.accepts("ludiff x y z -e a/b/c/")); // Check Reject Assert.assertFalse( "Accepts 'ludiff -er c1File.txt'.", this.cmd.accepts("ludiff -er c1File.txt")); Assert.assertTrue( "Should Contain Usage.", this.cmd.getProcessingFailure().contains(this.cmd.getUsage())); // assertFalse("Accepts 'ludiff abc -e /'.", // cmd.accepts("ludiff abc -e /")); Assert.assertFalse("Accepts 'ludiff -e '.", this.cmd.accepts("ludiff -e ")); // Check Exit and Usage Assert.assertFalse("Exits.", this.cmd.exits()); Assert.assertTrue("Usage.", this.cmd.getUsage().startsWith("luDiff {<luName>} -e <eName>")); }
/** * Cmd_ null headcurrent. * * @throws InvalidElementException the invalid element exception */ @Test public void cmd_NullHEADCURRENT() throws InvalidElementException { final Stage stage = new Stage(); TH.setupLogging(); stage.createLogicalUnit("lux"); CommandCLI cmd = new LUCmdStatus(stage, "lux"); Assert.assertTrue("CMDLUStatus Succeeds.", cmd.execute()); cmd = new LUCmdRevert(stage, "lux", 1, 0); Assert.assertFalse("CMDLURevert Fails.", cmd.execute()); }
/** * Setup test. * * @throws InvalidElementException the invalid element exception */ @Before public void setupTest() throws InvalidElementException { TH.setupTestingEnvironment(true, true); this.stage = new Stage(); TH.setupLogging(); }
/** Cmd_ elment remove missing element. */ @Test public void cmd_ElmentRemoveMissingElement() { this.cmd = new LUCmdElementRemove(this.stage, "aCard1", "c1File.txt"); TH.deleteFile(TH.w1File); Assert.assertTrue("Remove Missing Should Succeed.", this.cmd.execute()); }
/** * Start class test. * * @throws FileNotFoundException the file not found exception */ @BeforeClass public static void startClassTest() throws FileNotFoundException { TH.setupLogging(); Logger.getInstance().info("LOGICAL UNIT COMMANDS TEST"); UIWriter.setOutStream(new PrintStream(new FileOutputStream(TH.clioFile))); }