AttributeDefinition atr2 = mock(AttributeDefinition.class);
when(atr2.getId()).thenReturn(attr1);
when(atr2.getName()).thenAnswer(new Answer<LocalizableString>() {
@Override
public LocalizableString answer(InvocationOnMock invocationOnMock) throws Throwable {
LocalizableString nameLocalizerMock = mock(LocalizableString.class);
when(nameLocalizerMock.getString(any(Locale.class))).thenReturn("name" + id);
return nameLocalizerMock;
}
});
when(atr2.getDefaultValue()).thenAnswer(new Answer<LocalizableString>() {
@Override
public LocalizableString answer(InvocationOnMock invocationOnMock) throws Throwable {
LocalizableString nameLocalizerMock = mock(LocalizableString.class);
when(nameLocalizerMock.getString(any(Locale.class))).thenReturn("defaultValue" + id);
return nameLocalizerMock;
}
});
when(atr2.getDescription()).thenAnswer(new Answer<LocalizableString>() {
@Override
public LocalizableString answer(InvocationOnMock invocationOnMock) throws Throwable {
LocalizableString nameLocalizerMock = mock(LocalizableString.class);
when(nameLocalizerMock.getString(any(Locale.class))).thenReturn("description" + id);
return nameLocalizerMock;
}
});
return atr2;
}