DirectAdsField implements AdsField { public static DirectAdsField of(long indexGroup, long indexOffset, AdsDataType adsDataType, Integer numberOfElements) { return new DirectAdsField(indexGroup, indexOffset, adsDataType, numberOfElements); } private  DirectAdsField(long indexGroup, long indexOffset, AdsDataType adsDataType, Integer numberOfElements); static DirectAdsField of(long indexGroup, long indexOffset, AdsDataType adsDataType, Integer numberOfElements); static DirectAdsField of(String address); static boolean matches(String address); long getIndexGroup(); long getIndexOffset(); @Override AdsDataType getAdsDataType(); int getNumberOfElements(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }
@Test public void of() { DirectAdsField field = DirectAdsField.of("1/10:BYTE[2]"); assertThat(field.getIndexGroup(), is(1L)); assertThat(field.getIndexOffset(), is(10L)); assertThat(field.getAdsDataType(), is(AdsDataType.BYTE)); assertThat(field.getNumberOfElements(), is(2)); }
@Test(expected = PlcInvalidFieldException.class) public void stringInField() { DirectAdsField field = DirectAdsField.of("group/offset"); }
@Test(expected = PlcInvalidFieldException.class) public void singleNumberField() { DirectAdsField field = DirectAdsField.of("10"); }
@Test(expected = PlcInvalidFieldException.class) public void wrongSeperator() { DirectAdsField field = DirectAdsField.of("1:10"); }