@Override public boolean contains(@Nullable Object object) { return forwardList.contains(object); }
@Override public Exporter<?, ?> getExporter(String transferDataType) { Preconditions.checkArgument( initialized, "RememberTheMilkTransferExtension not initialized. Unable to get Exporter"); Preconditions.checkArgument(SUPPORTED_DATA_TYPES.contains(transferDataType)); return exporter; }
@Override public Exporter<?, ?> getExporter(String transferDataType) { Preconditions.checkArgument( initialized, "InstagramTransferExtension not initialized. Unable to get Exporter"); Preconditions.checkArgument(SUPPORTED_DATA_TYPES.contains(transferDataType)); return exporter; }
private static boolean isSupportedType(Type type) { if (isVarcharType(type)) { return true; } if (ImmutableList.of(BIGINT, INTEGER, SMALLINT, TINYINT, BOOLEAN, DOUBLE).contains(type)) { return true; } return false; }
private boolean isSupportedPrimitive(Type type) { return isVarcharType(type) || ImmutableList.of( BigintType.BIGINT, BooleanType.BOOLEAN, DoubleType.DOUBLE, VarbinaryType.VARBINARY).contains(type); }
private static boolean isSupportedType(Type type) { if (isVarcharType(type)) { return true; } if (ImmutableList.of(BIGINT, INTEGER, SMALLINT, TINYINT, BOOLEAN, DOUBLE).contains(type)) { return true; } return false; }
@Override public Exporter<?, ?> getExporter(String transferDataType) { Preconditions.checkArgument(initialized); Preconditions.checkArgument(SUPPORTED_SERVICES.contains(transferDataType)); return exporterMap.get(transferDataType); }
@Override public boolean contains(@NullableDecl Object object) { return forwardList.contains(object); }
private static Predicate<String> areAllReturnStatementsAssignable( ImmutableSet<ClassType> returnStatementsTypes) { return s -> returnStatementsTypes.stream() .map(MutableMethodReturnType::getImmutableSuperTypesForClassType) .allMatch(c -> c.contains(s)); }
private boolean isSupportedType(Type type) { if (isVarcharType(type)) { return true; } if (ImmutableList.of( BIGINT, INTEGER, SMALLINT, TINYINT, BOOLEAN, DOUBLE ).contains(type)) { return true; } return false; }
@Override public Void visitMethodInvocation(MethodInvocationTree tree, Void unused) { MethodSymbol methodSymbol = getSymbol(tree); if (methodSymbol == null || SIDE_EFFECT_FREE_CLASSES.contains(methodSymbol.owner.getQualifiedName().toString())) { return null; } hasSideEffect = true; return null; }
@Test public void should_glob_direct_files() { ImmutableList<String> files = Globs.glob("src/test/resources/details/foo.json"); assertThat(files.contains("src/test/resources/details/foo.json"), is(true)); }
@Test public void should_glob_absolute_files() throws IOException { File file = folder.newFile(); String path = file.getAbsolutePath(); ImmutableList<String> files = Globs.glob(path); assertThat(files.contains(path), is(true)); }
@Test public void should_parse_glob_settings_file() { InputStream stream = getResourceAsStream("settings/glob-settings.json"); ImmutableList<GlobalSetting> globalSettings = parser.parse(stream); ImmutableList<String> includes = globalSettings.get(0).includes(); assertThat(includes.contains(join("src", "test", "resources", "settings", "details", "foo.json")), is(true)); assertThat(includes.contains(join("src", "test", "resources", "settings", "details", "bar.json")), is(true)); }
@Test public void should_glob_absolute_files_with_glob() throws IOException { File file = folder.newFile("glob.json"); String glob = Files.join(folder.getRoot().getAbsolutePath(), "*.json"); ImmutableList<String> files = Globs.glob(glob); assertThat(files.contains(file.getAbsolutePath()), is(true)); }
public void testAsListInconsistentComprator() { ImmutableSet<String> set = ImmutableSortedSet.orderedBy(STRING_LENGTH) .add("in", "the", "quick", "jumped", "over", "a") .build(); ImmutableList<String> list = set.asList(); assertTrue(list.contains("the")); assertEquals(2, list.indexOf("the")); assertEquals(2, list.lastIndexOf("the")); assertFalse(list.contains("dog")); assertEquals(-1, list.indexOf("dog")); assertEquals(-1, list.lastIndexOf("dog")); assertFalse(list.contains("chicken")); assertEquals(-1, list.indexOf("chicken")); assertEquals(-1, list.lastIndexOf("chicken")); }
@Override public Void visitNewClass(NewClassTree tree, Void unused) { String classFullName = ""; if (tree.getIdentifier().getKind() == Kind.MEMBER_SELECT) { classFullName = ((JCFieldAccess) tree.getIdentifier()).sym.getQualifiedName().toString(); } else if (tree.getIdentifier().getKind() == Kind.IDENTIFIER) { classFullName = ((JCIdent) tree.getIdentifier()).sym.getQualifiedName().toString(); } if (SIDE_EFFECT_FREE_CLASSES.contains(classFullName)) { return null; } hasSideEffect = true; return null; }
/** * Generates test cases for the given combination of scenario and timeouts. For methods that take * an explicit timeout value, all of the given timeoutsToUse result in individual test cases. For * methods that do not take an explicit timeout value, a single test case is generated only if the * implicit timeout of that method matches the given timeoutsToUse. For example, enter() is * treated like enter(MAX, MILLIS) and tryEnter() is treated like enter(0, MILLIS). */ private static void addTests( TestSuite suite, Method method, Scenario scenario, TimeoutsToUse timeoutsToUse, Outcome expectedOutcome) { for (boolean fair : new boolean[] {true, false}) { if (isTimed(method)) { for (Timeout timeout : timeoutsToUse.timeouts) { suite.addTest(new GeneratedMonitorTest(method, scenario, fair, timeout, expectedOutcome)); } } else { Timeout implicitTimeout = (isTryEnter(method) ? Timeout.ZERO : Timeout.MAX); if (timeoutsToUse.timeouts.contains(implicitTimeout)) { suite.addTest(new GeneratedMonitorTest(method, scenario, fair, null, expectedOutcome)); } } } }
@Test public void testGetChildZones() { assertTrue(zone.getChildZones().isEmpty()); Zone child = new Zone("Child", () -> false); zone.addZone(child); assertFalse(zone.getChildZones().isEmpty()); assertTrue(zone.getChildZones().contains(child)); try { zone.getChildZone("Invalid name"); fail(); } catch (Exception e) {} assertEquals(child, zone.getChildZone("Child")); }