### Question:
AisBStaticDataReportPartB extends AbstractAisBStaticDataReport { @VisibleForTesting static int extractShipType(AisExtractor extractor) { return extractor.getValue(40, 48); } AisBStaticDataReportPartB(String message, int padBits);  AisBStaticDataReportPartB(String message, String source, int padBits);  AisBStaticDataReportPartB(AisExtractorFactory factory, String message, String source,
            int padBits); @Override String toString(); int getShipType(); Optional<String> getCallsign(); Optional<Integer> getDimensionA(); Optional<Integer> getDimensionB(); Optional<Integer> getDimensionC(); Optional<Integer> getDimensionD(); Optional<Integer> getLengthMetres(); Optional<Integer> getWidthMetres(); String getVendorManufacturerId(); Integer getVendorUnitModelCode(); Integer getVendorUnitSerialNumber();  }### Answer:
@Test public void testTypeOfShipAndCargoType() { final Integer typeOfShip = Integer.valueOf(123); AisExtractor ex = createMock(AisExtractor.class); expect(ex.getValue(anyInt(), anyInt())).andReturn(typeOfShip).atLeastOnce(); replay(ex); Integer result = AisBStaticDataReportPartB.extractShipType(ex); assertEquals(typeOfShip, result); verify(ex); }
@Test public void testTypeOfShipAndCargoTypeNotAvailable() { final Integer typeOfShip = Integer.valueOf(0); AisExtractor ex = createMock(AisExtractor.class); expect(ex.getValue(anyInt(), anyInt())).andReturn(typeOfShip).atLeastOnce(); replay(ex); Integer result = AisBStaticDataReportPartB.extractShipType(ex); assertEquals(0, result.intValue()); verify(ex); }