ITFWriterTestCase.java (zxing-zxing-3.4.0) | : | ITFWriterTestCase.java (zxing-zxing-3.4.1) | ||
---|---|---|---|---|
skipping to change at line 20 | skipping to change at line 20 | |||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | |||
* distributed under the License is distributed on an "AS IS" BASIS, | * distributed under the License is distributed on an "AS IS" BASIS, | |||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
* See the License for the specific language governing permissions and | * See the License for the specific language governing permissions and | |||
* limitations under the License. | * limitations under the License. | |||
*/ | */ | |||
package com.google.zxing.oned; | package com.google.zxing.oned; | |||
import com.google.zxing.BarcodeFormat; | import com.google.zxing.BarcodeFormat; | |||
import com.google.zxing.WriterException; | ||||
import com.google.zxing.common.BitMatrix; | import com.google.zxing.common.BitMatrix; | |||
import com.google.zxing.common.BitMatrixTestCase; | import com.google.zxing.common.BitMatrixTestCase; | |||
import org.junit.Assert; | import org.junit.Assert; | |||
import org.junit.Test; | import org.junit.Test; | |||
/** | /** | |||
* Tests {@link ITFWriter}. | * Tests {@link ITFWriter}. | |||
*/ | */ | |||
public final class ITFWriterTestCase extends Assert { | public final class ITFWriterTestCase extends Assert { | |||
@Test | @Test | |||
public void testEncode() throws WriterException { | public void testEncode() { | |||
doTest("00123456789012", | doTest("00123456789012", | |||
"00000101010101110001110001011101000101011100011101110100010100011101 00011" + | "00000101010101110001110001011101000101011100011101110100010100011101 00011" + | |||
"10001010100010101110001110101110100011100010111010001010111000111010 0000"); | "10001010100010101110001110101110100011100010111010001010111000111010 0000"); | |||
} | } | |||
private static void doTest(String input, CharSequence expected) throws WriterE xception { | private static void doTest(String input, CharSequence expected) { | |||
BitMatrix result = new ITFWriter().encode(input, BarcodeFormat.ITF, 0, 0); | BitMatrix result = new ITFWriter().encode(input, BarcodeFormat.ITF, 0, 0); | |||
assertEquals(expected, BitMatrixTestCase.matrixToString(result)); | assertEquals(expected, BitMatrixTestCase.matrixToString(result)); | |||
} | } | |||
@Test(expected = IllegalArgumentException.class) | @Test(expected = IllegalArgumentException.class) | |||
public void testEncodeIllegalCharacters() throws WriterException { | public void testEncodeIllegalCharacters() { | |||
new ITFWriter().encode("00123456789abc", BarcodeFormat.ITF, 0, 0); | new ITFWriter().encode("00123456789abc", BarcodeFormat.ITF, 0, 0); | |||
} | } | |||
} | } | |||
End of changes. 4 change blocks. | ||||
4 lines changed or deleted | 3 lines changed or added |