Esempio n. 1
0
  @Test
  @SuppressWarnings("unchecked")
  public void validate() {
    assertTrue("Project doesn't exist.", Eclim.projectExists(Wst.TEST_PROJECT));

    List<Map<String, Object>> results =
        (List<Map<String, Object>>)
            Eclim.execute(new String[] {"css_validate", "-p", Wst.TEST_PROJECT, "-f", TEST_FILE});

    assertEquals("Wrong number of errors.", 2, results.size());

    String file = Eclim.resolveFile(Wst.TEST_PROJECT, TEST_FILE);

    Map<String, Object> error = results.get(0);
    assertEquals(error.get("filename"), file);
    assertTrue(((String) error.get("message")).indexOf("bald is not a font-weight value") != -1);
    assertEquals(error.get("line"), 2);
    assertEquals(error.get("column"), 1);
    assertEquals(error.get("warning"), false);

    error = results.get(1);
    assertEquals(error.get("filename"), file);
    assertTrue(((String) error.get("message")).indexOf("Property fnt-size doesn't exist") != -1);
    assertEquals(error.get("line"), 6);
    assertEquals(error.get("column"), 1);
    assertEquals(error.get("warning"), false);
  }
Esempio n. 2
0
  @Test
  @SuppressWarnings("unchecked")
  public void executeTestToClass() {
    assertTrue("Java project doesn't exist.", Eclim.projectExists(Jdt.TEST_PROJECT));

    Map<String, Object> result =
        (Map<String, Object>)
            Eclim.execute(
                new String[] {
                  "java_junit_find_test",
                  "-p",
                  Jdt.TEST_PROJECT,
                  "-f",
                  TEST,
                  "-o",
                  "0",
                  "-e",
                  "utf-8",
                });
    assertEquals(Eclim.resolveFile(Jdt.TEST_PROJECT, CLASS), result.get("filename"));
    assertEquals("Foo", result.get("message"));
    assertEquals(3, result.get("line"));
    assertEquals(1, result.get("column"));

    result =
        (Map<String, Object>)
            Eclim.execute(
                new String[] {
                  "java_junit_find_test",
                  "-p",
                  Jdt.TEST_PROJECT,
                  "-f",
                  TEST,
                  "-o",
                  "178",
                  "-e",
                  "utf-8",
                });
    assertEquals(Eclim.resolveFile(Jdt.TEST_PROJECT, CLASS), result.get("filename"));
    assertEquals("foo", result.get("message"));
    assertEquals(5, result.get("line"));
    assertEquals(3, result.get("column"));

    result =
        (Map<String, Object>)
            Eclim.execute(
                new String[] {
                  "java_junit_find_test",
                  "-p",
                  Jdt.TEST_PROJECT,
                  "-f",
                  TEST,
                  "-o",
                  "374",
                  "-e",
                  "utf-8",
                });
    assertEquals(Eclim.resolveFile(Jdt.TEST_PROJECT, CLASS), result.get("filename"));
    assertEquals("foo", result.get("message"));
    assertEquals(10, result.get("line"));
    assertEquals(3, result.get("column"));
  }