"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "core/src/test/java/hudson/cli/handlers/ViewOptionHandlerTest.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.

ViewOptionHandlerTest.java  (jenkins-jenkins-2.302):ViewOptionHandlerTest.java  (jenkins-jenkins-2.303)
skipping to change at line 28 skipping to change at line 28
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*/ */
package hudson.cli.handlers; package hudson.cli.handlers;
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.assertThrows;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.verifyNoInteractions;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
import hudson.model.ViewGroup; import hudson.model.ViewGroup;
import hudson.model.View; import hudson.model.View;
import hudson.security.ACL; import hudson.security.ACL;
import hudson.security.Permission; import hudson.security.Permission;
import jenkins.model.Jenkins; import jenkins.model.Jenkins;
skipping to change at line 182 skipping to change at line 183
verifyNoInteractions(setter); verifyNoInteractions(setter);
} }
@Test public void reportEmptyViewNameRequestAsNull() { @Test public void reportEmptyViewNameRequestAsNull() {
assertNull(handler.getView("")); assertNull(handler.getView(""));
verifyNoInteractions(setter); verifyNoInteractions(setter);
} }
@Test public void reportViewSpaceNameRequestAsIAE() { @Test public void reportViewSpaceNameRequestAsIAE() {
try { final IllegalArgumentException e = assertThrows("No exception thrown. Ex
assertNull(handler.getView(" ")); pected IllegalArgumentException",
fail("No exception thrown. Expected IllegalArgumentException"); IllegalArgumentException.class, () -> assertNull(handler.getView
} catch (IllegalArgumentException e) { (" ")));
assertEquals("No view named inside view Jenkins", e.getMessage()); assertEquals("No view named inside view Jenkins", e.getMessage());
verifyNoInteractions(setter); verifyNoInteractions(setter);
}
} }
@Test public void reportNullViewAsNPE() { @Test public void reportNullViewAsNPE() {
try { assertThrows(NullPointerException.class, () -> handler.getView(null));
handler.getView(null); verifyNoInteractions(setter);
fail("No exception thrown. Expected NullPointerException");
} catch (NullPointerException e) {
verifyNoInteractions(setter);
}
} }
@Test public void refuseToReadOuterView() throws Exception { @Test public void refuseToReadOuterView() throws Exception {
denyAccessOn(outer); denyAccessOn(outer);
assertEquals( assertEquals(
"Access denied for: outer", "Access denied for: outer",
parseFailedWith(AccessDeniedException.class, "outer/nested/inner ") parseFailedWith(AccessDeniedException.class, "outer/nested/inner ")
); );
 End of changes. 3 change blocks. 
13 lines changed or deleted 9 lines changed or added

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