@Test public void testWithNoLists() { GlusterVolumeAdvancedDetails volDetailsEntity = new GlusterVolumeAdvancedDetails(); volDetailsEntity.setBrickDetails(getBrickDetails(0, 0, 0)); GlusterBrickAdvancedDetails model = GlusterBrickDetailMapper.map(volDetailsEntity, null); assertNotNull(model); assertNull(model.getGlusterClients()); assertNull(model.getMntOptions()); }
@Test public void testWithMultipleClientLists() { GlusterVolumeAdvancedDetails volDetailsEntity = new GlusterVolumeAdvancedDetails(); volDetailsEntity.setBrickDetails(getBrickDetails(2, 2, 2)); GlusterBrickAdvancedDetails model = GlusterBrickDetailMapper.map(volDetailsEntity, null); assertEquals(model.getGlusterClients().getGlusterClients().size(), 2); assertEquals( model.getMntOptions(), volDetailsEntity.getBrickDetails().get(0).getBrickProperties().getMntOptions()); assertEquals( model.getMemoryPools().getGlusterMemoryPools().size(), volDetailsEntity.getBrickDetails().get(0).getMemoryStatus().getMemPools().size()); }
@Test public void testWithNullChildObjects() { GlusterVolumeAdvancedDetails volDetailsEntity = new GlusterVolumeAdvancedDetails(); volDetailsEntity.setBrickDetails(getBrickDetails(1, 0, 0)); volDetailsEntity.getBrickDetails().get(0).setClients(null); volDetailsEntity.getBrickDetails().get(0).setMemoryStatus(null); GlusterBrickAdvancedDetails model = GlusterBrickDetailMapper.map(volDetailsEntity, null); assertNotNull(model); assertNull(model.getGlusterClients()); assertEquals( model.getMntOptions(), volDetailsEntity.getBrickDetails().get(0).getBrickProperties().getMntOptions()); assertNull(model.getMemoryPools()); }