@Test public void testSimpleBean() { String s = "test"; source.setS(s); assertEquals(s, proxy.getS()); proxy.setI(5); assertEquals(5, proxy.getI()); assertEquals(5, source.getI()); source.setStyle(SimpleBean.RealStyle.R_A); assertEquals(SimpleBeanInterface.Style.A, proxy.getStyle()); }
@Test public void testString() throws Exception { SimpleBean data = new SimpleBean().setS("data"); SimpleBeanInterface dataBean = (SimpleBeanInterface) beanDelegator.createDelegator(data); SimpleBeanInterface newData = (SimpleBeanInterface) beanFilter.createFilteredBean( dataBean, ImmutableSet.<String>of("s")); assertEquals("data", newData.getS()); newData = (SimpleBeanInterface) beanFilter.createFilteredBean( dataBean, ImmutableSet.<String>of("i")); assertNull("S is filtered out", newData.getS()); assertNotNull("Required field", newData.getRequired()); }
@Test public void testInt() throws Exception { SimpleBean data = new SimpleBean().setI(5); SimpleBeanInterface dataBean = (SimpleBeanInterface) beanDelegator.createDelegator(data); SimpleBeanInterface newData = (SimpleBeanInterface) beanFilter.createFilteredBean( dataBean, ImmutableSet.<String>of("i")); assertEquals(5, newData.getI()); newData = (SimpleBeanInterface) beanFilter.createFilteredBean( dataBean, ImmutableSet.<String>of("s")); // Filter is ignored for primitive types: assertEquals(5, newData.getI()); }
@Before public void setUp() { beanDelegator = createSimpleDelegator(); source = new SimpleBean(); proxy = (SimpleBeanInterface) beanDelegator.createDelegator(source); }
/** * Test json conversion of a TestInterface into a TestObject * * @throws Exception the exception */ @Test public void testJsonToObject() throws Exception { String json = "{x:'xValue',y:'yValue'}"; TestObject object = (TestObject) beanJsonConverter.convertToObject(json, TestInterface.class); assertNotNull("expected 'x' field not set after json conversion", object.getX()); assertNotNull("expected 'y' field not set after json conversion", object.getY()); }
@Test public void testEmptyExtendableBean() throws Exception { String emptyMap = "{}"; ExtendableTestObject data = beanJsonConverter.convertToObject(emptyMap, ExtendableTestObject.class); assertTrue(data.isEmpty()); }
@Test public void testString() throws Exception { SimpleBean data = new SimpleBean().setS("data"); SimpleBeanInterface dataBean = (SimpleBeanInterface) beanDelegator.createDelegator(data); SimpleBeanInterface newData = (SimpleBeanInterface) beanFilter.createFilteredBean( dataBean, ImmutableSet.<String>of("s")); assertEquals("data", newData.getS()); newData = (SimpleBeanInterface) beanFilter.createFilteredBean( dataBean, ImmutableSet.<String>of("i")); assertNull("S is filtered out", newData.getS()); assertNotNull("Required field", newData.getRequired()); }
@Test public void testInt() throws Exception { SimpleBean data = new SimpleBean().setI(5); SimpleBeanInterface dataBean = (SimpleBeanInterface) beanDelegator.createDelegator(data); SimpleBeanInterface newData = (SimpleBeanInterface) beanFilter.createFilteredBean( dataBean, ImmutableSet.<String>of("i")); assertEquals(5, newData.getI()); newData = (SimpleBeanInterface) beanFilter.createFilteredBean( dataBean, ImmutableSet.<String>of("s")); // Filter is ignored for primitive types: assertEquals(5, newData.getI()); }
@Test public void testSimpleBean() { String s = "test"; source.setS(s); assertEquals(s, proxy.getS()); proxy.setI(5); assertEquals(5, proxy.getI()); assertEquals(5, source.getI()); source.setStyle(SimpleBean.RealStyle.R_A); assertEquals(SimpleBeanInterface.Style.A, proxy.getStyle()); }
@Before public void setUp() { beanDelegator = createSimpleDelegator(); source = new SimpleBean(); proxy = (SimpleBeanInterface) beanDelegator.createDelegator(source); }
/** * Test json conversion of a TestInterface into a TestObject * * @throws Exception the exception */ @Test public void testJsonToObject() throws Exception { String json = "{x:'xValue',y:'yValue'}"; TestObject object = (TestObject) beanJsonConverter.convertToObject(json, TestInterface.class); assertNotNull("expected 'x' field not set after json conversion", object.getX()); assertNotNull("expected 'y' field not set after json conversion", object.getY()); }
@Test public void testString() throws Exception { SimpleBean data = new SimpleBean().setS("data"); SimpleBeanInterface dataBean = (SimpleBeanInterface) beanDelegator.createDelegator(data); SimpleBeanInterface newData = (SimpleBeanInterface) beanFilter.createFilteredBean( dataBean, ImmutableSet.<String>of("s")); assertEquals("data", newData.getS()); newData = (SimpleBeanInterface) beanFilter.createFilteredBean( dataBean, ImmutableSet.<String>of("i")); assertNull("S is filtered out", newData.getS()); assertNotNull("Required field", newData.getRequired()); }
@Test public void testInt() throws Exception { SimpleBean data = new SimpleBean().setI(5); SimpleBeanInterface dataBean = (SimpleBeanInterface) beanDelegator.createDelegator(data); SimpleBeanInterface newData = (SimpleBeanInterface) beanFilter.createFilteredBean( dataBean, ImmutableSet.<String>of("i")); assertEquals(5, newData.getI()); newData = (SimpleBeanInterface) beanFilter.createFilteredBean( dataBean, ImmutableSet.<String>of("s")); // Filter is ignored for primitive types: assertEquals(5, newData.getI()); }
@Test public void testSimpleBean() { String s = "test"; source.setS(s); assertEquals(s, proxy.getS()); proxy.setI(5); assertEquals(5, proxy.getI()); assertEquals(5, source.getI()); source.setStyle(SimpleBean.RealStyle.R_A); assertEquals(SimpleBeanInterface.Style.A, proxy.getStyle()); }
@Before public void setUp() { beanDelegator = createSimpleDelegator(); source = new SimpleBean(); proxy = (SimpleBeanInterface) beanDelegator.createDelegator(source); }
@Test public void testString() throws Exception { SimpleBean data = new SimpleBean().setS("data"); SimpleBeanInterface dataBean = (SimpleBeanInterface) beanDelegator.createDelegator(data); SimpleBeanInterface newData = (SimpleBeanInterface) beanFilter.createFilteredBean( dataBean, ImmutableSet.<String>of("s")); assertEquals("data", newData.getS()); newData = (SimpleBeanInterface) beanFilter.createFilteredBean( dataBean, ImmutableSet.<String>of("i")); assertNull("S is filtered out", newData.getS()); assertNotNull("Required field", newData.getRequired()); }
@Test public void testInt() throws Exception { SimpleBean data = new SimpleBean().setI(5); SimpleBeanInterface dataBean = (SimpleBeanInterface) beanDelegator.createDelegator(data); SimpleBeanInterface newData = (SimpleBeanInterface) beanFilter.createFilteredBean( dataBean, ImmutableSet.<String>of("i")); assertEquals(5, newData.getI()); newData = (SimpleBeanInterface) beanFilter.createFilteredBean( dataBean, ImmutableSet.<String>of("s")); // Filter is ignored for primitive types: assertEquals(5, newData.getI()); }
@Test public void testSimpleBean() { String s = "test"; source.setS(s); assertEquals(s, proxy.getS()); proxy.setI(5); assertEquals(5, proxy.getI()); assertEquals(5, source.getI()); source.setStyle(SimpleBean.RealStyle.R_A); assertEquals(SimpleBeanInterface.Style.A, proxy.getStyle()); }
@Before public void setUp() { beanDelegator = createSimpleDelegator(); source = new SimpleBean(); proxy = (SimpleBeanInterface) beanDelegator.createDelegator(source); }
@Test public void testInt() throws Exception { SimpleBean data = new SimpleBean().setI(5); SimpleBeanInterface dataBean = (SimpleBeanInterface) beanDelegator.createDelegator(data); SimpleBeanInterface newData = (SimpleBeanInterface) beanFilter.createFilteredBean( dataBean, ImmutableSet.<String>of("i")); assertEquals(5, newData.getI()); newData = (SimpleBeanInterface) beanFilter.createFilteredBean( dataBean, ImmutableSet.<String>of("s")); // Filter is ignored for primitive types: assertEquals(5, newData.getI()); }