import com.holonplatform.core.internal.DefaultParameterSet; //導入方法依賴的package包/類
@Test
public void testParameterBuilder() {
ParameterSet ps = ParameterSet.builder().parameter("test", "TEST").parameter("test2", Integer.valueOf(3))
.build();
assertTrue(ps.hasParameter("test"));
assertTrue(ps.hasNotNullParameter("test"));
assertTrue(ps.hasParameter("test2"));
assertTrue(ps.hasNotNullParameter("test2"));
assertFalse(ps.hasParameter((String) null));
assertFalse(ps.hasNotNullParameter((String) null));
String sv = ps.getParameter("test", String.class).orElse(null);
assertNotNull(sv);
assertEquals("TEST", sv);
Integer iv = ps.getParameter("test2", Integer.class).orElse(null);
assertNotNull(iv);
assertEquals(Integer.valueOf(3), iv);
ParameterSet ps2 = ParameterSet.builder().parameters(ps).build();
assertTrue(ps2.hasParameters());
assertTrue(ps2.hasParameter("test"));
assertTrue(ps2.hasNotNullParameter("test"));
assertTrue(ps2.hasParameter("test2"));
assertTrue(ps2.hasNotNullParameter("test2"));
DefaultParameterSet ps3 = new DefaultParameterSet();
ps3.addParameter("p1", Integer.valueOf(1));
ps3.addParameter("p2", Integer.valueOf(2));
ps3.removeParameter("p2");
String ts = ps3.toString();
assertNotNull(ts);
Integer pv = ps3.getParameter("p1x", Integer.class, null);
assertNull(pv);
Integer pvi = ps3.getParameter("p1", Integer.class, null);
assertEquals(Integer.valueOf(1), pvi);
DefaultParameterSet ps4 = new DefaultParameterSet(null);
assertFalse(ps4.hasParameters());
ParameterSet ps5 = new DefaultParameterSet();
ps5.toString();
}