// Path: src/main/java/org/sputnikdev/bluetooth/manager/transport/CharacteristicAccessType.java
// public enum CharacteristicAccessType {
// 
//     BROADCAST(0x01),
//     READ(0x02),
//     WRITE_WITHOUT_RESPONSE(0x04),
//     WRITE(0x08),
//     NOTIFY(0x10),
//     INDICATE(0x20),
//     AUTHENTICATED_SIGNED_WRITES(0x40),
//     EXTENDED_PROPERTIES(0x80);
// 
//     int bitField;
// 
//     CharacteristicAccessType(int bitField) {
//         this.bitField = bitField;
//     }
// 
//     public int getBitField() {
//         return bitField;
//     }
// 
//     public static CharacteristicAccessType fromBitField(int bitField) {
//         return Stream.of(CharacteristicAccessType.values())
//                 .filter(c -> c.bitField == bitField)
//                 .findFirst().orElse(null);
//     }
// 
//     public static Set<CharacteristicAccessType> parse(int flags) {
//         return Stream.of(CharacteristicAccessType.values())
//                 .filter(c -> (c.bitField & flags) > 0)
//                 .collect(Collectors.toSet());
//     }
// 
// }


import org.junit.Test;
import java.util.Set;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.sputnikdev.bluetooth.manager.transport.CharacteristicAccessType.*;
package org.sputnikdev.bluetooth.manager.transport;





public class CharacteristicAccessTypeTest {

    @Test
    public void testGetBitField() throws Exception {
        assertEquals(0x01, BROADCAST.getBitField());
        assertEquals(0x02, READ.getBitField());
        assertEquals(0x04, WRITE_WITHOUT_RESPONSE.getBitField());
        assertEquals(0x08, WRITE.getBitField());
        assertEquals(0x10, NOTIFY.getBitField());
        assertEquals(0x20, INDICATE.getBitField());
        assertEquals(0x40, AUTHENTICATED_SIGNED_WRITES.getBitField());
        assertEquals(0x80, EXTENDED_PROPERTIES.getBitField());
    }

    @Test
    public void testFromBitField() throws Exception {
        assertEquals(BROADCAST, fromBitField(0b00000001));
        assertEquals(READ, fromBitField(0b00000010));
        assertEquals(WRITE_WITHOUT_RESPONSE, fromBitField(0b00000100));
        assertEquals(WRITE, fromBitField(0b00001000));
        assertEquals(NOTIFY, fromBitField(0b00010000));
        assertEquals(INDICATE, fromBitField(0b00100000));
        assertEquals(AUTHENTICATED_SIGNED_WRITES, fromBitField(0b01000000));
        assertEquals(EXTENDED_PROPERTIES, fromBitField(0b10000000));
    }

    @Test
    public void testParse() throws Exception {
        int notify = 0b00010000;
// Path: src/main/java/org/sputnikdev/bluetooth/manager/transport/CharacteristicAccessType.java
// public enum CharacteristicAccessType {
// 
//     BROADCAST(0x01),
//     READ(0x02),
//     WRITE_WITHOUT_RESPONSE(0x04),
//     WRITE(0x08),
//     NOTIFY(0x10),
//     INDICATE(0x20),
//     AUTHENTICATED_SIGNED_WRITES(0x40),
//     EXTENDED_PROPERTIES(0x80);
// 
//     int bitField;
// 
//     CharacteristicAccessType(int bitField) {
//         this.bitField = bitField;
//     }
// 
//     public int getBitField() {
//         return bitField;
//     }
// 
//     public static CharacteristicAccessType fromBitField(int bitField) {
//         return Stream.of(CharacteristicAccessType.values())
//                 .filter(c -> c.bitField == bitField)
//                 .findFirst().orElse(null);
//     }
// 
//     public static Set<CharacteristicAccessType> parse(int flags) {
//         return Stream.of(CharacteristicAccessType.values())
//                 .filter(c -> (c.bitField & flags) > 0)
//                 .collect(Collectors.toSet());
//     }
// 
// }


// Path: src/test/java/org/sputnikdev/bluetooth/manager/transport/CharacteristicAccessTypeTest.java
import org.junit.Test;
import java.util.Set;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.sputnikdev.bluetooth.manager.transport.CharacteristicAccessType.*;

package org.sputnikdev.bluetooth.manager.transport;





public class CharacteristicAccessTypeTest {

    @Test
    public void testGetBitField() throws Exception {
        assertEquals(0x01, BROADCAST.getBitField());
        assertEquals(0x02, READ.getBitField());
        assertEquals(0x04, WRITE_WITHOUT_RESPONSE.getBitField());
        assertEquals(0x08, WRITE.getBitField());
        assertEquals(0x10, NOTIFY.getBitField());
        assertEquals(0x20, INDICATE.getBitField());
        assertEquals(0x40, AUTHENTICATED_SIGNED_WRITES.getBitField());
        assertEquals(0x80, EXTENDED_PROPERTIES.getBitField());
    }

    @Test
    public void testFromBitField() throws Exception {
        assertEquals(BROADCAST, fromBitField(0b00000001));
        assertEquals(READ, fromBitField(0b00000010));
        assertEquals(WRITE_WITHOUT_RESPONSE, fromBitField(0b00000100));
        assertEquals(WRITE, fromBitField(0b00001000));
        assertEquals(NOTIFY, fromBitField(0b00010000));
        assertEquals(INDICATE, fromBitField(0b00100000));
        assertEquals(AUTHENTICATED_SIGNED_WRITES, fromBitField(0b01000000));
        assertEquals(EXTENDED_PROPERTIES, fromBitField(0b10000000));
    }

    @Test
    public void testParse() throws Exception {
        int notify = 0b00010000;
        Set<CharacteristicAccessType> actual = parse(notify);