@TestTargetNew( level = TestLevel.COMPLETE, notes = "", method = "getProvider", args = {}) public void testGetProvider() { Provider p = new MyProvider(); Provider.Service s1 = new Provider.Service(p, "type", "algorithm", "className", null, null); assertTrue(s1.getProvider() == p); Provider.Service s2 = new Provider.Service( p, "SecureRandom", "algorithm", "tests.java.security.support.RandomImpl", null, null); assertTrue(s2.getProvider() == p); }
@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"); } }