Add core plugin explicit movement method test
This commit is contained in:
		
							parent
							
								
									94aef9934e
								
							
						
					
					
						commit
						dfa21f68e2
					
				| @ -56,6 +56,7 @@ import static org.mockito.ArgumentMatchers.any; | ||||
| import static org.mockito.ArgumentMatchers.eq; | ||||
| import static org.mockito.Mockito.RETURNS_MOCKS; | ||||
| import static org.mockito.Mockito.mock; | ||||
| import static org.mockito.Mockito.never; | ||||
| import static org.mockito.Mockito.times; | ||||
| import static org.mockito.Mockito.verify; | ||||
| import static org.mockito.Mockito.when; | ||||
| @ -213,52 +214,6 @@ public class CorePluginTest { | ||||
|         assertEquals(impl.map.toString(), 0, impl.map.size()); | ||||
|     } | ||||
| 
 | ||||
|     @Test | ||||
|     public void plugin_methods() { | ||||
|         // checks that only expected plugin methods are overridden | ||||
| 
 | ||||
|         // these represent actual methods that are present (we expect them to be present) | ||||
|         final Set<String> usedMethods = new HashSet<String>() {{ | ||||
|             add("configureVisitor"); | ||||
|             add("configureSpansFactory"); | ||||
|             add("beforeSetText"); | ||||
|             add("afterSetText"); | ||||
|             add("priority"); | ||||
|             add("addOnTextAddedListener"); | ||||
|         }}; | ||||
| 
 | ||||
|         // we will use declaredMethods because it won't return inherited ones | ||||
|         final Method[] declaredMethods = CorePlugin.class.getDeclaredMethods(); | ||||
|         assertNotNull(declaredMethods); | ||||
|         assertTrue(declaredMethods.length > 0); | ||||
| 
 | ||||
|         final List<String> methods = Ix.fromArray(declaredMethods) | ||||
|                 .filter(new IxPredicate<Method>() { | ||||
|                     @Override | ||||
|                     public boolean test(Method method) { | ||||
|                         // ignore private, static | ||||
|                         final int modifiers = method.getModifiers(); | ||||
|                         return !Modifier.isStatic(modifiers) | ||||
|                                 && !Modifier.isPrivate(modifiers); | ||||
|                     } | ||||
|                 }) | ||||
|                 .map(new IxFunction<Method, String>() { | ||||
|                     @Override | ||||
|                     public String apply(Method method) { | ||||
|                         return method.getName(); | ||||
|                     } | ||||
|                 }) | ||||
|                 .filter(new IxPredicate<String>() { | ||||
|                     @Override | ||||
|                     public boolean test(String s) { | ||||
|                         return !usedMethods.contains(s); | ||||
|                     } | ||||
|                 }) | ||||
|                 .toList(); | ||||
| 
 | ||||
|         assertEquals(methods.toString(), 0, methods.size()); | ||||
|     } | ||||
| 
 | ||||
|     @Test | ||||
|     public void softbreak() { | ||||
| 
 | ||||
| @ -320,6 +275,15 @@ public class CorePluginTest { | ||||
|         verify(textView, times(0)).setMovementMethod(any(MovementMethod.class)); | ||||
|     } | ||||
| 
 | ||||
|     @Test | ||||
|     public void explicit_movement_method() { | ||||
|         final TextView textView = mock(TextView.class); | ||||
|         final CorePlugin plugin = CorePlugin.create() | ||||
|                 .hasExplicitMovementMethodPlugin(true); | ||||
|         plugin.afterSetText(textView); | ||||
|         verify(textView, never()).setMovementMethod(any(MovementMethod.class)); | ||||
|     } | ||||
| 
 | ||||
|     @Test | ||||
|     public void code_block_info_prop() { | ||||
|         final CorePlugin plugin = CorePlugin.create(); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Dimitry Ivanov
						Dimitry Ivanov