/** * Argument that is either <code>null</code> or of the given type. * * <p> * See examples in javadoc for {@link ArgumentMatchers} class * </p> * * @param clazz Type to avoid casting * @return <code>null</code>. */ public static <T> T nullable(Class<T> clazz) { AdditionalMatchers.or(isNull(), isA(clazz)); return (T) Primitives.defaultValue(clazz); }
@Test public void shouldReturnChangeSetsFromAPreviouslyKnownRevisionUptilTheLatest() throws Exception { Changeset[] changeSets = getChangeSets(42); when(client.queryHistory(eq(TFS_PROJECT), or(isNull(), any(ChangesetVersionSpec.class)), anyInt())).thenReturn(changeSets); TfsSDKCommand spy = spy(tfsCommand); doReturn(null).when(spy).getModifiedFiles(changeSets[0]); List<Modification> modifications = spy.modificationsSince(null, new StringRevision("2")); assertThat(modifications.isEmpty(), is(false)); verify(client, times(2)).queryHistory(eq(TFS_PROJECT), or(isNull(), any(ChangesetVersionSpec.class)), anyInt()); }
/** * Delegates call to {@link AdditionalMatchers#or(boolean, boolean)}. */ default boolean or(boolean first, boolean second) { return AdditionalMatchers.or(first, second); }
/** * Delegates call to {@link AdditionalMatchers#or(short, short)}. */ default short or(short first, short second) { return AdditionalMatchers.or(first, second); }
/** * Delegates call to {@link AdditionalMatchers#or(T, T)}. */ default <T> T or(T first, T second) { return AdditionalMatchers.or(first, second); }
/** * Delegates call to {@link AdditionalMatchers#or(double, double)}. */ default double or(double first, double second) { return AdditionalMatchers.or(first, second); }
/** * Delegates call to {@link AdditionalMatchers#or(double, double)}. */ default double or(double first, double second) { return AdditionalMatchers.or(first, second); }
/** * Delegates call to {@link AdditionalMatchers#or(char, char)}. */ default char or(char first, char second) { return AdditionalMatchers.or(first, second); }
/** * Delegates call to {@link AdditionalMatchers#or(float, float)}. */ default float or(float first, float second) { return AdditionalMatchers.or(first, second); }
/** * Delegates call to {@link AdditionalMatchers#or(int, int)}. */ default int or(int first, int second) { return AdditionalMatchers.or(first, second); }
/** * Delegates call to {@link AdditionalMatchers#or(char, char)}. */ default char or(char first, char second) { return AdditionalMatchers.or(first, second); }
/** * Delegates call to {@link AdditionalMatchers#or(boolean, boolean)}. */ default boolean or(boolean first, boolean second) { return AdditionalMatchers.or(first, second); }
/** * Delegates call to {@link AdditionalMatchers#or(short, short)}. */ default short or(short first, short second) { return AdditionalMatchers.or(first, second); }
/** * Delegates call to {@link AdditionalMatchers#or(long, long)}. */ default long or(long first, long second) { return AdditionalMatchers.or(first, second); }
/** * Delegates call to {@link AdditionalMatchers#or(long, long)}. */ default long or(long first, long second) { return AdditionalMatchers.or(first, second); }
/** * Delegates call to {@link AdditionalMatchers#or(int, int)}. */ default int or(int first, int second) { return AdditionalMatchers.or(first, second); }
/** * Delegates call to {@link AdditionalMatchers#or(byte, byte)}. */ default byte or(byte first, byte second) { return AdditionalMatchers.or(first, second); }
/** * Delegates call to {@link AdditionalMatchers#or(T, T)}. */ default <T> T or(T first, T second) { return AdditionalMatchers.or(first, second); }
/** * Delegates call to {@link AdditionalMatchers#or(float, float)}. */ default float or(float first, float second) { return AdditionalMatchers.or(first, second); }
/** * Delegates call to {@link AdditionalMatchers#or(byte, byte)}. */ default byte or(byte first, byte second) { return AdditionalMatchers.or(first, second); }