You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.4 KiB
41 lines
1.4 KiB
package de.superx.servlet; |
|
|
|
import static org.junit.Assert.assertEquals; |
|
import static org.junit.Assert.assertFalse; |
|
import static org.junit.Assert.assertTrue; |
|
import static org.mockito.Mockito.when; |
|
|
|
import org.junit.Test; |
|
|
|
public class SuperXmlMenuTest extends BaseServletTest { |
|
|
|
private final String SERVLET_INFO = "SuperXmlMenu 4.0"; |
|
|
|
private SuperXmlMenu superXmlMenu = new SuperXmlMenu(); |
|
|
|
@Test |
|
public void testGetShowNavigation() { |
|
when(this.request.getParameter("navi")).thenReturn(null); |
|
when(this.request.getAttribute("navi")).thenReturn("true"); |
|
|
|
boolean result = this.superXmlMenu.getShowNavigation(this.request); |
|
assertTrue("method returns true", result); |
|
|
|
when(this.request.getAttribute("navi")).thenReturn("false"); |
|
result = this.superXmlMenu.getShowNavigation(this.request); |
|
assertFalse("method returns false", result); |
|
|
|
when(this.request.getAttribute("navi")).thenReturn(null); |
|
result = this.superXmlMenu.getShowNavigation(this.request); |
|
assertFalse("method returns false", result); |
|
|
|
when(this.request.getAttribute("navi")).thenReturn(""); |
|
result = this.superXmlMenu.getShowNavigation(this.request); |
|
assertFalse("method returns false", result); |
|
} |
|
|
|
@Test |
|
public void testGetServletInfo() { |
|
assertEquals("method returns expected value", this.SERVLET_INFO, this.superXmlMenu.getServletInfo()); |
|
} |
|
}
|
|
|