コード例 #1
0
 @TestTargetNew(
     level = TestLevel.COMPLETE,
     notes = "",
     method = "supportsParameter",
     args = {java.lang.Object.class})
 public void testSupportsParameter() {
   Provider p = new MyProvider();
   Provider.Service s1 = new Provider.Service(p, "type", "algorithm", "className", null, null);
   assertTrue(s1.supportsParameter(null));
   assertTrue(s1.supportsParameter(new Object()));
 }
コード例 #2
0
  @TestTargetNew(
      level = TestLevel.COMPLETE,
      notes = "",
      method = "Service",
      args = {
        java.security.Provider.class,
        java.lang.String.class,
        java.lang.String.class,
        java.lang.String.class,
        java.util.List.class,
        java.util.Map.class
      })
  public void testService() {
    Provider p = new MyProvider();
    try {
      new Provider.Service(null, "type", "algorithm", "className", null, null);
      fail("provider is null: No expected NullPointerException");
    } catch (NullPointerException e) {
    }
    try {
      new Provider.Service(p, null, "algorithm", "className", null, null);
      fail("type is null: No expected NullPointerException");
    } catch (NullPointerException e) {
    }
    try {
      new Provider.Service(p, "type", null, "className", null, null);
      fail("algorithm is null: No expected NullPointerException");
    } catch (NullPointerException e) {
    }
    try {
      new Provider.Service(p, "type", "algorithm", null, null, null);
      fail("className is null: No expected NullPointerException");
    } catch (NullPointerException e) {
    }

    Provider.Service s = new Provider.Service(p, "type", "algorithm", "className", null, null);

    if (!s.getType().equals("type")) {
      fail("getType() failed");
    }
    if (!s.getAlgorithm().equals("algorithm")) {
      fail("getAlgorithm() failed");
    }
    if (s.getProvider() != p) {
      fail("getProvider() failed");
    }
    if (!s.getClassName().equals("className")) {
      fail("getClassName() failed");
    }
    if (!s.supportsParameter(new Object())) {
      fail("supportsParameter() failed");
    }
  }