コード例 #1
0
  @Before
  public void setUp() throws Exception {
    renderer = new AnwenderloesungStartPageRenderer();
    VelocityAdapter velocityAdapter = new VelocityAdapter();

    renderer.velocityAdapter = velocityAdapter;
    Hardcoded.enableDefaults(renderer.velocityAdapter);
    localizationEngineSupport = mock(LocalizationEngineSupport.class);
    when(localizationEngineSupport.getLocalizedText(
            anyString(), anyString(), anyString(), anyString()))
        .thenAnswer(
            new Answer<String>() {

              @Override
              public String answer(InvocationOnMock invocation) throws Throwable {
                String s = "";
                Object[] arguments = invocation.getArguments();
                for (Object object : arguments) {
                  s += "/" + object;
                }
                return s;
              }
            });
    when(localizationEngineSupport.getDocumentUrl(anyString(), anyString(), anyString()))
        .thenAnswer(
            new Answer<String>() {

              @Override
              public String answer(InvocationOnMock invocation) throws Throwable {
                return invocation.getArguments()[2] + "_" + invocation.getArguments()[1];
              }
            });
  }
コード例 #2
0
 @Test
 public void renderStartPage() {
   Szenario szenario = szenario("s1");
   AnwenderloesungRenderingContainer container =
       new AnwenderloesungRenderingContainer(
           "id", szenario, new SzenarioUserData(), Arrays.asList("de"), true, true, true, true);
   String x =
       renderer.renderStartPage(
           container, new LocalizationEngine(localizationEngineSupport, "model", "de"));
   assertTrue(x, x.contains(szenario.getId()));
   htmlChecker.checkHtmlString(x);
 }
コード例 #3
0
  @Test
  public void renderStartPageWithXMLModel() {
    Szenario szenario = szenario("s1");
    SzenarioUserData szenarioUserData = new SzenarioUserData();
    szenarioUserData.setProjektname("projekt abc");
    AnwenderloesungRenderingContainer container =
        new AnwenderloesungRenderingContainer(
            "id", szenario, szenarioUserData, Arrays.asList("de"), true, true, true, true);
    String x =
        renderer.renderStartPage(
            container, new LocalizationEngine(localizationEngineSupport, "model", "de"));
    assertTrue(x, x.contains("projekt abc"));
    assertTrue(x, x.toLowerCase().contains("xml"));

    assertFalse(x, x.contains(szenario.getId()));
    htmlChecker.checkHtmlString(x);
  }