@Test
  public void testCustomProvidersFeature() {
    JerseyConfiguration instance = new JerseyConfiguration();
    instance.register(new CustomProvidersFeature(Arrays.asList(new Class<?>[] {MyProvider.class})));

    assertTrue(instance.getProviderClasses().contains(MyProvider.class));
  }
 @Test
 @Ignore("not ready yet")
 // TODO implement test
 public void testGetProviderInstances() {
   JerseyConfiguration instance = new JerseyConfiguration();
   Set expResult = null;
   Set result = instance.getProviderInstances();
   assertEquals(expResult, result);
   fail("The test case is a prototype.");
 }
 @Test
 @Ignore("not ready yet")
 // TODO implement test
 public void testEnable_Feature() {
   Feature feature = null;
   JerseyConfiguration instance = new JerseyConfiguration();
   JerseyConfiguration expResult = null;
   JerseyConfiguration result = instance.register(feature);
   assertEquals(expResult, result);
   fail("The test case is a prototype.");
 }
 @Test
 @Ignore("not ready yet")
 // TODO implement test
 public void testRegister_ObjectArr() {
   Object[] providers = null;
   JerseyConfiguration instance = new JerseyConfiguration();
   JerseyConfiguration expResult = null;
   JerseyConfiguration result = instance.register(providers);
   assertEquals(expResult, result);
   fail("The test case is a prototype.");
 }
 @Test
 @Ignore("not ready yet")
 // TODO implement test
 public void testUpdate() {
   JerseyConfiguration jerseyConfiguration = null;
   JerseyConfiguration instance = new JerseyConfiguration();
   JerseyConfiguration expResult = null;
   JerseyConfiguration result = instance.update(jerseyConfiguration);
   assertEquals(expResult, result);
   fail("The test case is a prototype.");
 }
 @Test
 @Ignore("not ready yet")
 // TODO implement test
 public void testIsEnabled() {
   Class<? extends Feature> feature = null;
   JerseyConfiguration instance = new JerseyConfiguration();
   boolean expResult = false;
   boolean result = instance.isEnabled(feature);
   assertEquals(expResult, result);
   fail("The test case is a prototype.");
 }
  @Test
  public void testSetProperties() {
    Map<String, String> props = new HashMap<String, String>();
    props.put("name1", "value1");
    props.put("name2", "value2");
    props.put("name3", "value3");

    JerseyConfiguration instance = new JerseyConfiguration().setProperties(props);
    assertEquals("value1", instance.getProperty("name1"));
    assertEquals("value2", instance.getProperty("name2"));
    assertEquals("value3", instance.getProperty("name3"));
    assertNull(instance.getProperty("other"));
  }
  @Test
  public void testGetProperties() {
    JerseyConfiguration instance = new JerseyConfiguration();
    Map result = instance.getProperties();
    assertNotNull(result);

    instance.setProperty("name", "value");
    assertEquals("value", result.get("name"));

    try {
      result.remove("name");
      fail("UnsupportedOperationException expected");
    } catch (UnsupportedOperationException ex) {
      // ok
    }
  }
  @Test
  public void testSnapshot() {
    JerseyConfiguration c_a = new JerseyConfiguration().setProperty("common_name", "common_value");

    JerseyConfiguration c_b = c_a.snapshot();
    assertNotNull(c_b);
    assertNotSame(c_a, c_b);
    assertEquals(c_a, c_b);
    assertEquals("common_value", c_a.getProperty("common_name"));
    assertEquals("common_value", c_b.getProperty("common_name"));

    c_b.setProperty("name", "value");

    assertFalse(c_a.equals(c_b));
    assertEquals("value", c_b.getProperty("name"));
    assertNull(c_a.getProperty("name"));
  }
예제 #10
0
  @Test
  public void testSetProperty() {
    JerseyConfiguration instance = new JerseyConfiguration();
    assertTrue(instance.getProperties().isEmpty());

    instance.setProperty("name", "value");
    assertFalse(instance.getProperties().isEmpty());
    assertEquals(1, instance.getProperties().size());
    assertEquals("value", instance.getProperty("name"));
  }
예제 #11
0
 @Test
 public void testGetProperty() {
   JerseyConfiguration instance = new JerseyConfiguration().setProperty("name", "value");
   assertEquals("value", instance.getProperty("name"));
   assertNull(instance.getProperty("other"));
 }