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);