/** * Get the field name qualifier for this injection. * @return the field name qualifier for this injection which may be empty string where not set. */ public String getQualifier() { return annotation.fieldName(); }
String name = annotation.name();
private static MockType mockTypeFromAnnotation(Mock annotation) { MockType valueMockType = annotation.value(); MockType mockType = annotation.type(); if(valueMockType != MockType.DEFAULT && mockType != MockType.DEFAULT) { throw new AssertionError("@Mock.value() and @Mock.type() are aliases, you can't specify both at the same time"); } if(valueMockType != MockType.DEFAULT) { mockType = valueMockType; } return mockType; }
/** * Add an {@link Injection} to this container. It will be managed according to the presence * of a fieldName qualifier, and attempting to add an Injection with a duplicate fieldName * qualifier will cause an error. * * @param injection Injection to manage as part of this plan */ public void addInjection(Injection injection) { String qualifier = injection.getAnnotation().fieldName(); if (qualifier.length() != 0) { blockDuplicateQualifiers(qualifier); qualifiedInjections.add(injection); } else { unqualifiedInjections.add(injection); } }
@RunWith(EasyMockRunner.class) public class MemoizerTest { @Mock private Computable<Integer, Integer> computable;
if (!injection.isMatched()) { throw new AssertionError( String.format("Unsatisfied qualifier: '%s'", injection.getAnnotation().fieldName()));
public final ExpectedException expectedException = ExpectedException.none(); @Mock(MockType.NICE) private KsqlConfig ksqlConfig; @Mock(MockType.NICE) private KsqlEngine mockKsqlEngine; @Mock(MockType.NICE) private ServiceContext serviceContext; @Mock(MockType.NICE) private KafkaTopicClient mockKafkaTopicClient; @Mock(MockType.NICE) private StatementParser mockStatementParser; @Mock private CommandQueue commandQueue; @Mock(MockType.NICE) private ActivenessRegistrar activenessRegistrar; @Mock private Consumer<QueryMetadata> queryCloseCallback; private StreamedQueryResource testResource;
private KsqlServerMain main; @Mock(MockType.NICE) private Executable executable;
@Mock(MockType.NICE) private PrintWriter mockPrintWriter;
new ServerInfo("1.x", "myClusterId", "myKsqlServiceId"); @Mock(MockType.NICE) private KsqlRestClient restClient; private RemoteServerSpecificCommand command;
); @Mock(MockType.NICE) private PropertyParser parser; private LocalProperties propsWithMockParser;
@Mock(type = MockType.NICE) private ServiceInterfaceWithParamNameAnnotation mockService; private JsonRpcMultiServer multiServer;