Package it.hotel.aspects

Examples of it.hotel.aspects.RemoveMultiLingualInterceptor


   
    ILocaleContainer localeContainer = createMock(ILocaleContainer.class);
    ILabelManager labelManager = createMock(ILabelManager.class);
    MethodInvocation invoke = createMock(MethodInvocation.class);
   
    RemoveMultiLingualInterceptor interceptor = new RemoveMultiLingualInterceptor();
    interceptor.setLabelManager(labelManager);
    interceptor.setLocaleContainer(localeContainer);
   
    Hotel h = new Hotel();
    h.setBriefdescription("Hotel.Briefdescription");
    h.setDescription("Hotel.Description");
    h.setId(1);
    HotelManager hmanager = new HotelManager();
    Class cls = HotelManager.class;
    Method m = cls.getMethod("remove", new Class[] {Object.class});
   
    Label label = new Label();
    label.setCode("Hotel.Briefdescription");
    label.setId(1);
    label.setLanguage("it");
    label.setText("this is something");
   
   
    HashMap<String,Label> labelList = new HashMap<String,Label>();
    labelList.put("Hotel.Briefdescription", label);
   
    expect(localeContainer.getLocale()).andReturn("it");
    expectLastCall().anyTimes();
    expect(labelManager.getLabels(1,"Hotel.Briefdescription")).andReturn(labelList);
    expect(labelManager.getLabels(1,"Hotel.Description")).andReturn(labelList);
    labelManager.remove(isA(Label.class));
    labelManager.remove(isA(Label.class));
   
    Object[] obj = {h};
   
    expect(invoke.getArguments()).andReturn(obj);
    expect(invoke.getThis()).andReturn(hmanager);
    expect(invoke.proceed()).andReturn(null);
   
    replay(labelManager);
    replay(localeContainer);
    replay(invoke);
   
    try {
      interceptor.invoke(invoke)
    }catch (Throwable t){
      throw(t);
    }
   
    verify(labelManager);
View Full Code Here


    HotelManager hotelManagerMock =
        org.easymock.classextension.EasyMock.createMock(HotelManager.class,  new Method[] {
             HotelManager.class.getMethod("get",int.class),
        } );
   
    RemoveMultiLingualInterceptor interceptor = new RemoveMultiLingualInterceptor();
    interceptor.setLabelManager(labelManager);
    interceptor.setLocaleContainer(localeContainer);
   
    Hotel h = new Hotel();
    h.setBriefdescription("Hotel.Briefdescription");
    h.setDescription("Hotel.Description");
    h.setId(1);
    HotelManager hmanager = new HotelManager();
    Class cls = HotelManager.class;
    Method m = cls.getMethod("remove", new Class[] {int.class});
   
    Label label = new Label();
    label.setCode("Hotel.Briefdescription");
    label.setId(1);
    label.setLanguage("it");
    label.setText("this is something");
   
   
    HashMap<String,Label> labelList = new HashMap<String,Label>();
    labelList.put("Hotel.Briefdescription", label);
   
    expect(hotelManagerMock.get(1)).andReturn(h);
   
    expect(localeContainer.getLocale()).andReturn("it");
    expectLastCall().anyTimes();
    expect(labelManager.getLabels(1,"Hotel.Briefdescription")).andReturn(labelList);
    expect(labelManager.getLabels(1,"Hotel.Description")).andReturn(labelList);
    labelManager.remove(isA(Label.class));
    labelManager.remove(isA(Label.class));
   
    Integer i = new Integer(1);
    Object[] obj = {i};
   
    expect(invoke.getArguments()).andReturn(obj);
    expect(invoke.getThis()).andReturn(hotelManagerMock);
    expect(invoke.proceed()).andReturn(null);
   
    replay(labelManager);
    replay(localeContainer);
    replay(invoke);
    org.easymock.classextension.EasyMock.replay(hotelManagerMock);
   
   
   
    try {
      interceptor.invoke(invoke)
    }catch (Throwable t){
      throw(t);
    }
   
    verify(labelManager);
View Full Code Here

TOP

Related Classes of it.hotel.aspects.RemoveMultiLingualInterceptor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.