Java Code Examples for org.apache.commons.lang3.SystemUtils#IS_JAVA_1_8
The following examples show how to use
org.apache.commons.lang3.SystemUtils#IS_JAVA_1_8 .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ConfigDefaultMethod.java From cuba with Apache License 2.0 | 6 votes |
@Override public Object invoke(ConfigHandler handler, Object[] args, Object proxy) { try { if (SystemUtils.IS_JAVA_1_8) { // hack to invoke default method of an interface reflectively Constructor<MethodHandles.Lookup> lookupConstructor = MethodHandles.Lookup.class.getDeclaredConstructor(Class.class, Integer.TYPE); if (!lookupConstructor.isAccessible()) { lookupConstructor.setAccessible(true); } return lookupConstructor.newInstance(configInterface, MethodHandles.Lookup.PRIVATE) .unreflectSpecial(configMethod, configInterface) .bindTo(proxy) .invokeWithArguments(args); } else { return MethodHandles.lookup() .findSpecial(configInterface, configMethod.getName(), MethodType.methodType(configMethod.getReturnType(), configMethod.getParameterTypes()), configInterface) .bindTo(proxy) .invokeWithArguments(args); } } catch (Throwable throwable) { throw new RuntimeException("Error invoking default method of config interface", throwable); } }
Example 2
Source File: MgrsTest.java From baleen with Apache License 2.0 | 6 votes |
@Test public void testWithText() throws Exception { jCas.setDocumentText( "James has almost certainly never been to 4QFJ1267. But he's been to 4QFJ1268"); new Text(jCas, 0, 51).addToIndexes(); // Dont add the second one ... so we should still get 1 results new Text(jCas, 52, // jCas.getDocumentText().length()).addToIndexes(); processJCas(); String geoJson; if (SystemUtils.IS_JAVA_1_8) { geoJson = GEOJSON_8; } else { geoJson = GEOJSON; } assertAnnotations(1, Coordinate.class, new TestCoordinate(0, "4QFJ1267", "mgrs", geoJson)); }
Example 3
Source File: EntityGraphFileTest.java From baleen with Apache License 2.0 | 6 votes |
@Test public void testGraphson() throws AnalysisEngineProcessException, ResourceInitializationException, IOException, URISyntaxException { // Due to serialisation order differences URL expectedFile; if (SystemUtils.IS_JAVA_1_8) { expectedFile = EXPECTED_GRAPHSON_8_FILE; } else { expectedFile = EXPECTED_GRAPHSON_FILE; } processJCas( EntityGraph.PARAM_OUTPUT_DIRECTORY, tempDirectory.toString(), EntityGraph.PARAM_GRAPH_FORMAT, GraphFormat.GRAPHSON.toString()); Path actual = tempDirectory.resolve(tempDirectory.toFile().list()[0]); Path expected = createAndFailIfMissing(actual, expectedFile, GRAPHSON_NAME); assertPathsEqual(expected, actual); Files.delete(actual); }
Example 4
Source File: EntityGraphFileTest.java From baleen with Apache License 2.0 | 6 votes |
@Test public void testGyro() throws AnalysisEngineProcessException, ResourceInitializationException, IOException, URISyntaxException { // Due to serialisation order differences URL expectedFile; if (SystemUtils.IS_JAVA_1_8) { expectedFile = EXPECTED_GRYO_8_FILE; } else { expectedFile = EXPECTED_GRYO_FILE; } processJCas( EntityGraph.PARAM_OUTPUT_DIRECTORY, tempDirectory.toString(), EntityGraph.PARAM_GRAPH_FORMAT, GraphFormat.GRYO.toString()); Path path = tempDirectory.resolve(tempDirectory.toFile().list()[0]); Path expectedPath = createAndFailIfMissing(path, expectedFile, GYRO_NAME); assertTrue(com.google.common.io.Files.equal(expectedPath.toFile(), path.toFile())); Files.delete(path); }
Example 5
Source File: JdkVersionTest.java From cuba with Apache License 2.0 | 5 votes |
@Test public void test() { if (SystemUtils.IS_JAVA_1_8) { System.out.println( "---------------tests are running on JAVA 8---------------" ); } else if (SystemUtils.IS_JAVA_10) { System.out.println( "---------------tests are running on JAVA 10---------------" ); } }
Example 6
Source File: MgrsTest.java From baleen with Apache License 2.0 | 5 votes |
@Test public void test() throws Exception { jCas.setDocumentText("James has almost certainly never been to 4QFJ1267"); processJCas(); String geoJson; if (SystemUtils.IS_JAVA_1_8) { geoJson = GEOJSON_8; } else { geoJson = GEOJSON; } assertAnnotations(1, Coordinate.class, new TestCoordinate(0, "4QFJ1267", "mgrs", geoJson)); }
Example 7
Source File: SchedulerTest.java From caffeine with Apache License 2.0 | 5 votes |
@Test public void hasSystemScheduler() { Scheduler scheduler = SystemUtils.IS_JAVA_1_8 ? Scheduler.disabledScheduler() : SystemScheduler.INSTANCE; assertThat(Scheduler.systemScheduler(), is(scheduler)); }
Example 8
Source File: JavaVersion.java From arquillian-governor with Apache License 2.0 | 4 votes |
@Override public boolean detected() { return SystemUtils.IS_JAVA_1_8; }