@Test public void testDataCodingsFactories() { for (int i = 0; i < 256; i++) { byte expected = (byte) (0xff & i); DataCoding dataCoding = DataCodings.newInstance(expected); if (i < 64) { assertEquals(DataCodings.newInstance(expected).getClass().getName(), "org.jsmpp.bean.GeneralDataCoding"); } else if (i < 192) { assertEquals(DataCodings.newInstance(expected).getClass().getName(), "org.jsmpp.bean.RawDataCoding"); } else if (i < 240) { assertEquals(DataCodings.newInstance(expected).getClass().getName(), "org.jsmpp.bean.MessageWaitingDataCoding"); } else { assertEquals(DataCodings.newInstance(expected).getClass().getName(), "org.jsmpp.bean.SimpleDataCoding"); } if (i < 192) { assertEquals(dataCoding.toByte(), expected); } } }
public static DataCoding newInstance(byte dataCoding) { for (DataCodingFactory factory : factories) { if (factory.isRecognized(dataCoding)) { return factory.newInstance(dataCoding); } } return new RawDataCoding(dataCoding); }
DataCodings { public static DataCoding newInstance(byte dataCoding) { for (DataCodingFactory factory : factories) { if (factory.isRecognized(dataCoding)) { return factory.newInstance(dataCoding); } } return new RawDataCoding(dataCoding); } }
DataCodings { public static DataCoding newInstance(byte dataCoding) { for (DataCodingFactory factory : factories) { if (factory.isRecognized(dataCoding)) { return factory.newInstance(dataCoding); } } return new RawDataCoding(dataCoding); } private  DataCodings(); }
DataCodings { public static DataCoding newInstance(byte dataCoding) { for (DataCodingFactory factory : factories) { if (factory.isRecognized(dataCoding)) { return factory.newInstance(dataCoding); } } return new RawDataCoding(dataCoding); } private  DataCodings(); static DataCoding newInstance(byte dataCoding); static boolean containsMessageClass(byte dataCoding); }
DataCodings { public static DataCoding newInstance(byte dataCoding) { for (DataCodingFactory factory : factories) { if (factory.isRecognized(dataCoding)) { return factory.newInstance(dataCoding); } } return new RawDataCoding(dataCoding); } private  DataCodings(); static DataCoding newInstance(byte dataCoding); static boolean containsMessageClass(byte dataCoding); static final byte MASK_CONTAIN_MESSAGE_CLASS; static final DataCoding ZERO; }