Java Code Examples for java.nio.file.AccessMode

Following code examples demonstrate how to use java.nio.file.AccessModefrom java. These examples are extracted from various highly rated open source projects. You can directly use these code snippets or view their entire linked source code. These snippets are extracted to provide contextual information about how to use this class in the real world. These samples also let you understand some good practices on how to use java.nio.file.AccessModeand various code implementation of this class.

    @Test
    public void testEnumerationUsage()
    {
        List<ClassReference> references = ASTProcessor.analyze(getLibraryPaths(), getSourcePaths(),
                    Paths.get("src/test/resources/testclasses/enumeration/EnumerationClassUsage.java"));
        int counter = 0;
        for (ClassReference reference : references)
        {
            if (reference.getQualifiedName().startsWith("java.nio.file.AccessMode") && reference.getLocation() == TypeReferenceLocation.ENUM_CONSTANT)
            {
                System.out.println("Reference: " + reference);
                counter++;
            }
        }
        Assert.assertEquals(3, counter);

        ClassReference referenceTest = new ClassReference("java.nio.file.AccessMode.WRITE", "java.nio.file", "AccessMode", null,
                    ResolutionStatus.RESOLVED, TypeReferenceLocation.ENUM_CONSTANT, 12, 4, 39, "AccessMode testMode=AccessMode.WRITE;");
        Assert.assertTrue(references.contains(referenceTest));

        referenceTest = new ClassReference("java.nio.file.AccessMode.WRITE", "java.nio.file", "AccessMode", null,
                    ResolutionStatus.RESOLVED, TypeReferenceLocation.ENUM_CONSTANT, 17, 30, 18, "EnumerationClassUsage.testAccessibleEnum(AccessMode.WRITE)");
        Assert.assertTrue(references.contains(referenceTest));

        referenceTest = new ClassReference("java.nio.file.AccessMode.READ", "java.nio.file", "AccessMode", null,
                ResolutionStatus.RESOLVED, TypeReferenceLocation.ENUM_CONSTANT, 31, 41, 21, "new EnumerationClassUsage(AccessMode.READ)");
        Assert.assertTrue(references.contains(referenceTest));
    } 


	public static void main(String[] args) {
		new Shared().doSomething();
		Converter<String, AccessMode> converter = Enums.stringConverter(AccessMode.class);
	} 

    @Test
    public default void verifyGenericType()
    throws Exception {
        final Class<SUT> sut = createNewSUT();
        assertTrue("This j8unit test interface is used with a generic type that is illegaly not assignable to AccessMode.class!",
                   AccessMode.class.isAssignableFrom(sut));
    } 

  void fromByteCode() {
    useValues(AccessMode.values());
    useValueOf(AccessMode.valueOf("READ"));
  }