use of org.mockito.internal.stubbing.answers.ReturnsArgumentAt in project AuthMeReloaded by AuthMe.
the class HelpProviderTest method setDefaultHelpMessages.
private static void setDefaultHelpMessages(HelpMessagesService helpMessagesService) {
given(helpMessagesService.buildLocalizedDescription(any(CommandDescription.class))).willAnswer(new ReturnsArgumentAt(0));
for (HelpMessage key : HelpMessage.values()) {
String text = key.name().replace("_", " ").toLowerCase();
given(helpMessagesService.getMessage(key)).willReturn(text.substring(0, 1).toUpperCase() + text.substring(1));
}
for (DefaultPermission permission : DefaultPermission.values()) {
String text = permission.name().replace("_", " ").toLowerCase();
given(helpMessagesService.getMessage(permission)).willReturn(text.substring(0, 1).toUpperCase() + text.substring(1));
}
for (HelpSection section : HelpSection.values()) {
String text = section.name().replace("_", " ").toLowerCase();
given(helpMessagesService.getMessage(section)).willReturn(text.substring(0, 1).toUpperCase() + text.substring(1));
}
}
use of org.mockito.internal.stubbing.answers.ReturnsArgumentAt in project hazelcast by hazelcast.
the class PredicateTestUtils method createPassthroughVisitor.
static Visitor createPassthroughVisitor() {
Visitor visitor = mock(Visitor.class);
when(visitor.visit((AndPredicate) anyObject(), (Indexes) anyObject())).thenAnswer(new ReturnsArgumentAt(0));
when(visitor.visit((OrPredicate) anyObject(), (Indexes) anyObject())).thenAnswer(new ReturnsArgumentAt(0));
when(visitor.visit((NotPredicate) anyObject(), (Indexes) anyObject())).thenAnswer(new ReturnsArgumentAt(0));
return visitor;
}
use of org.mockito.internal.stubbing.answers.ReturnsArgumentAt in project frames by tinkerpop.
the class FramedGraphFactoryTest method testFactory.
@Test
public void testFactory() {
Mockito.when(mockModule.configure(Mockito.any(Graph.class), Mockito.any(FramedGraphConfiguration.class))).then(new ReturnsArgumentAt(0));
FramedGraphFactory graphFactory = new FramedGraphFactory(mockModule);
FramedGraph<Graph> framed = graphFactory.create(base);
Assert.assertEquals(base, framed.getBaseGraph());
Mockito.verify(mockModule, Mockito.times(1)).configure(Mockito.any(Graph.class), Mockito.any(FramedGraphConfiguration.class));
TransactionalGraph baseTransactional = Mockito.mock(TransactionalGraph.class);
FramedTransactionalGraph<TransactionalGraph> framedTransactional = graphFactory.create(baseTransactional);
Assert.assertEquals(baseTransactional, framedTransactional.getBaseGraph());
Mockito.verify(mockModule, Mockito.times(2)).configure(Mockito.any(TransactionalGraph.class), Mockito.any(FramedGraphConfiguration.class));
}
use of org.mockito.internal.stubbing.answers.ReturnsArgumentAt in project frames by tinkerpop.
the class FramedGraphFactoryTest method testSubclassing.
@Test
public void testSubclassing() {
MyFramedGraphFactory myFramedGraphFactory = new MyFramedGraphFactory(mockModule);
Mockito.when(mockModule.configure(Mockito.any(Graph.class), Mockito.any(FramedGraphConfiguration.class))).then(new ReturnsArgumentAt(0));
MyFramedGraph<Graph> create = myFramedGraphFactory.create(base);
Assert.assertEquals(base, create.getBaseGraph());
}
Aggregations