CodabarBean extends AbstractBarcodeBean { @Override public BarcodeDimension calcDimensions(String msg) { double width = 0.0; for (int i = 0; i < msg.length(); i++) { if (i > 0) { width += moduleWidth; } width += calcCharWidth(msg.charAt(i)); } final double qz = hasQuietZone() ? quietZone : 0; return new BarcodeDimension(width, getHeight(), width + (2 * qz), getHeight(), quietZone, 0.0); } CodabarBean(); ChecksumMode getChecksumMode(); void setChecksumMode(ChecksumMode mode); double getWideFactor(); void setWideFactor(double value); @Override double getBarWidth(int width); boolean isDisplayStartStop(); void setDisplayStartStop(boolean value); @Override void generateBarcode(CanvasProvider canvas, String msg); @Override BarcodeDimension calcDimensions(String msg); @Override Collection<String> getAdditionalNames(); @Override String getId();  }
@Test public void testCalcDimensions() { System.out.println("calcDimensions"); String msg = "12345"; CodabarBean instance = new CodabarBean(); instance.setModuleWidth(1); BarcodeDimension expResult = new BarcodeDimension(59.0, 17.822); BarcodeDimension result = instance.calcDimensions(msg); assertEquals(expResult.getWidth(), result.getWidth(), 0.01); assertEquals(expResult.getHeight(), result.getHeight(), 0.01); }