"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "core/src/test/java/hudson/model/AbstractItemTest.java" between
jenkins-jenkins-2.302.tar.gz and jenkins-jenkins-2.303.tar.gz

About: Jenkins is a automation server (written in Java) which can be used to automate all sorts of tasks related to building, testing, and delivering or deploying software (for e.g. as Continuous Integration and Continuous Delivery server). Weekly release.

AbstractItemTest.java  (jenkins-jenkins-2.302):AbstractItemTest.java  (jenkins-jenkins-2.303)
package hudson.model; package hudson.model;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull; import static org.junit.Assert.assertNull;
import static org.junit.Assert.fail; import static org.junit.Assert.assertThrows;
import java.io.IOException; import java.io.IOException;
import java.util.Collection; import java.util.Collection;
import org.junit.Test; import org.junit.Test;
import org.jvnet.hudson.test.Issue; import org.jvnet.hudson.test.Issue;
/** /**
* @author kingfai * @author kingfai
*/ */
skipping to change at line 118 skipping to change at line 118
} }
@Test @Test
@Issue("JENKINS-58571") @Issue("JENKINS-58571")
public void renameMethodShouldThrowExceptionWhenNotIsNameEditable() { public void renameMethodShouldThrowExceptionWhenNotIsNameEditable() {
//GIVEN //GIVEN
NameNotEditableItem item = new NameNotEditableItem(null,"NameNotEditable Item"); NameNotEditableItem item = new NameNotEditableItem(null,"NameNotEditable Item");
//WHEN //WHEN
try { final IOException e = assertThrows("An item with isNameEditable false mu
item.renameTo("NewName"); st throw exception when trying to rename it.",
fail("An item with isNameEditable false must throw exception when tr IOException.class, () -> item.renameTo("NewName"));
ying to rename it.");
} catch (IOException e) { assertEquals("Trying to rename an item that does not support this operat
ion.", e.getMessage());
//THEN assertEquals("NameNotEditableItem", item.getName());
assertEquals("Trying to rename an item that does not support this op
eration.", e.getMessage());
assertEquals("NameNotEditableItem",item.getName());
}
} }
@Test @Test
@Issue("JENKINS-58571") @Issue("JENKINS-58571")
public void doConfirmRenameMustThrowFormFailureWhenNotIsNameEditable() throw s IOException { public void doConfirmRenameMustThrowFormFailureWhenNotIsNameEditable() throw s IOException {
//GIVEN //GIVEN
NameNotEditableItem item = new NameNotEditableItem(null,"NameNotEditable Item"); NameNotEditableItem item = new NameNotEditableItem(null,"NameNotEditable Item");
//WHEN //WHEN
try { final Failure f = assertThrows("An item with isNameEditable false must t
item.doConfirmRename("MyNewName"); hrow exception when trying to call doConfirmRename.",
fail("An item with isNameEditable false must throw exception when tr Failure.class, () -> item.doConfirmRename("MyNewName"));
ying to call doConfirmRename."); assertEquals("Trying to rename an item that does not support this operat
} catch (Failure f) { ion.", f.getMessage());
assertEquals("NameNotEditableItem", item.getName());
//THEN
assertEquals("Trying to rename an item that does not support this op
eration.", f.getMessage());
assertEquals("NameNotEditableItem",item.getName());
}
} }
} }
 End of changes. 3 change blocks. 
23 lines changed or deleted 14 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)