assertTrue(connectorAttributes.get("name1").equals("val1"));
assertTrue(connectorAttributes.get("name2").equals("val2"));
}
private AttributeDefinition createAttributeMock(String attr1, final String id) {
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;