PageRenderTime 49ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/jboss-as-7.1.1.Final/clustering/web-spi/src/test/java/org/jboss/as/clustering/web/impl/SessionAttributeMarshallerFactoryTest.java

#
Java | 55 lines | 24 code | 6 blank | 25 comment | 0 complexity | f65057f63332e05ef2c882cfc74c704c MD5 | raw file
Possible License(s): LGPL-2.1, Apache-2.0
  1. /*
  2. * JBoss, Home of Professional Open Source.
  3. * Copyright 2010, Red Hat Middleware LLC, and individual contributors
  4. * as indicated by the @author tags. See the copyright.txt file in the
  5. * distribution for a full listing of individual contributors.
  6. *
  7. * This is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU Lesser General Public License as
  9. * published by the Free Software Foundation; either version 2.1 of
  10. * the License, or (at your option) any later version.
  11. *
  12. * This software is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with this software; if not, write to the Free
  19. * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  20. * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  21. */
  22. package org.jboss.as.clustering.web.impl;
  23. import static org.junit.Assert.assertNotNull;
  24. import static org.junit.Assert.assertTrue;
  25. import static org.mockito.Mockito.mock;
  26. import static org.mockito.Mockito.when;
  27. import org.jboss.as.clustering.web.LocalDistributableSessionManager;
  28. import org.jboss.as.clustering.web.SessionAttributeMarshaller;
  29. import org.jboss.as.clustering.web.SessionAttributeMarshallerFactory;
  30. import org.jboss.marshalling.ClassResolver;
  31. import org.jboss.marshalling.MarshallerFactory;
  32. import org.junit.Test;
  33. /**
  34. * @author Paul Ferraro
  35. *
  36. */
  37. public class SessionAttributeMarshallerFactoryTest {
  38. @Test
  39. public void test() {
  40. MarshallerFactory marshallerFactory = mock(MarshallerFactory.class);
  41. LocalDistributableSessionManager manager = mock(LocalDistributableSessionManager.class);
  42. SessionAttributeMarshallerFactory factory = new SessionAttributeMarshallerFactoryImpl(marshallerFactory);
  43. ClassResolver resolver = mock(ClassResolver.class);
  44. when(manager.getApplicationClassResolver()).thenReturn(resolver);
  45. SessionAttributeMarshaller marshaller = factory.createMarshaller(manager);
  46. assertNotNull(marshaller);
  47. assertTrue(marshaller instanceof SessionAttributeMarshallerImpl);
  48. }
  49. }