Examples of MockPortletContext


Examples of org.springframework.mock.web.portlet.MockPortletContext

    assertNotNull(portletBean.getTestParam());
    assertEquals(testValue, portletBean.getTestParam());
  }
 
  public void testInitParameterNotSet() throws Exception {
    PortletContext portletContext = new MockPortletContext();
    MockPortletConfig portletConfig = new MockPortletConfig(portletContext);
    TestPortletBean portletBean = new TestPortletBean();
    assertNull(portletBean.getTestParam());
    portletBean.init(portletConfig);
    assertNull(portletBean.getTestParam());
View Full Code Here

Examples of org.springframework.mock.web.portlet.MockPortletContext

    portletBean.init(portletConfig);
    assertNull(portletBean.getTestParam());
  }

  public void testMultipleInitParametersSet() throws Exception {
    PortletContext portletContext = new MockPortletContext();
    MockPortletConfig portletConfig = new MockPortletConfig(portletContext);
    String testValue = "testValue";
    String anotherValue = "anotherValue";
    portletConfig.addInitParameter("testParam", testValue);
    portletConfig.addInitParameter("anotherParam", anotherValue);
View Full Code Here

Examples of org.springframework.mock.web.portlet.MockPortletContext

    assertEquals(testValue, portletBean.getTestParam());
    assertEquals(anotherValue, portletBean.getAnotherParam());
  }

  public void testMultipleInitParametersOnlyOneSet() throws Exception {
    PortletContext portletContext = new MockPortletContext();
    MockPortletConfig portletConfig = new MockPortletConfig(portletContext);
    String testValue = "testValue";
    portletConfig.addInitParameter("testParam", testValue);
    portletConfig.addInitParameter("unknownParam", "unknownValue");
    TestPortletBean portletBean = new TestPortletBean();
View Full Code Here

Examples of org.springframework.mock.web.portlet.MockPortletContext

    assertEquals(testValue, portletBean.getTestParam());
    assertNull(portletBean.getAnotherParam());
  }

  public void testRequiredInitParameterSet() throws Exception {
    PortletContext portletContext = new MockPortletContext();
    MockPortletConfig portletConfig = new MockPortletConfig(portletContext);
    String testParam = "testParam";
    String testValue = "testValue";
    portletConfig.addInitParameter(testParam, testValue);
    TestPortletBean portletBean = new TestPortletBean();
View Full Code Here

Examples of org.springframework.mock.web.portlet.MockPortletContext

    assertNotNull(portletBean.getTestParam());
    assertEquals(testValue, portletBean.getTestParam());
  }

  public void testRequiredInitParameterNotSet() throws Exception {
    PortletContext portletContext = new MockPortletContext();
    MockPortletConfig portletConfig = new MockPortletConfig(portletContext);
    String testParam = "testParam";
    TestPortletBean portletBean = new TestPortletBean();
    portletBean.addRequiredProperty(testParam);
    assertNull(portletBean.getTestParam());
View Full Code Here

Examples of org.springframework.mock.web.portlet.MockPortletContext

      // expected
    }
  }
 
  public void testRequiredInitParameterNotSetOtherParameterNotSet() throws Exception {
    PortletContext portletContext = new MockPortletContext();
    MockPortletConfig portletConfig = new MockPortletConfig(portletContext);
    String testParam = "testParam";
    String testValue = "testValue";
    portletConfig.addInitParameter(testParam, testValue);
    TestPortletBean portletBean = new TestPortletBean();
View Full Code Here

Examples of org.springframework.mock.web.portlet.MockPortletContext

    }
    assertNull(portletBean.getTestParam());
  }

  public void testUnknownRequiredInitParameter() throws Exception {
    PortletContext portletContext = new MockPortletContext();
    MockPortletConfig portletConfig = new MockPortletConfig(portletContext);
    String testParam = "testParam";
    String testValue = "testValue";
    portletConfig.addInitParameter(testParam, testValue);
    TestPortletBean portletBean = new TestPortletBean();
View Full Code Here

Examples of org.springframework.mock.web.portlet.MockPortletContext

      }
    }.runTest();
  }

  public void testGetTempDirSunnyDay() throws Exception {
    MockPortletContext ctx = new MockPortletContext();
    Object expectedTempDir = new File("doesn't exist but that's ok in the context of this test");
    ctx.setAttribute(WebUtils.TEMP_DIR_CONTEXT_ATTRIBUTE, expectedTempDir);
    assertSame(expectedTempDir, PortletUtils.getTempDir(ctx));
  }
View Full Code Here

Examples of org.springframework.mock.web.portlet.MockPortletContext

  }

  public void testGetRealPathWithNullPath() throws Exception {
    new AssertThrows(NullPointerException.class) {
      public void test() throws Exception {
        PortletUtils.getRealPath(new MockPortletContext(), null);
      }
    }.runTest();
  }
View Full Code Here

Examples of org.springframework.mock.web.portlet.MockPortletContext

  }

  public void testGetRealPathWithPathThatCannotBeResolvedToFile() throws Exception {
    new AssertThrows(FileNotFoundException.class) {
      public void test() throws Exception {
        PortletUtils.getRealPath(new MockPortletContext() {
          public String getRealPath(String path) {
            return null;
          }
        }, "/rubbish");
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.