### Question:
ClasspathOperationsImpl implements ClasspathOperations { @Override public void focus(final JavaType type) { Validate.notNull(type, "Specify the type to focus on"); final String physicalTypeIdentifier = typeLocationService.getPhysicalTypeIdentifier(type); Validate.notNull(physicalTypeIdentifier, "Cannot locate the type %s", type.getFullyQualifiedTypeName()); final PhysicalTypeMetadata ptm = (PhysicalTypeMetadata) metadataService.get(physicalTypeIdentifier); Validate.notNull(ptm, "Class %s does not exist", PhysicalTypeIdentifier.getFriendlyName(physicalTypeIdentifier)); }  @Override void createClass(final JavaType name, final boolean rooAnnotations,
      final LogicalPath path, final JavaType superclass, final JavaType implementsType,
      final boolean createAbstract, final boolean permitReservedWords); @Override void createConstructor(final JavaType name, final Set<String> fields); @Override void createEnum(final JavaType name, final LogicalPath path,
      final boolean permitReservedWords); @Override void createInterface(final JavaType name, final LogicalPath path,
      final boolean permitReservedWords); @Override void enumConstant(final JavaType name, final JavaSymbolName fieldName,
      final boolean permitReservedWords); @Override void focus(final JavaType type); @Override boolean isProjectAvailable(); String replaceTopLevelPackageString(ClassOrInterfaceTypeDetails cid, String currentText); @Override String replaceTopLevelPackage(ClassOrInterfaceTypeDetails cid);  }### Answer:
@Test public void testFocusOnTypeThatCannotBeLocated() { final JavaType mockType = mock(JavaType.class); final String typeName = "com.example.domain.Lost"; when(mockType.getFullyQualifiedTypeName()).thenReturn(typeName); when(mockTypeLocationService.getPhysicalTypeIdentifier(mockType)).thenReturn(null); try { classpathOperations.focus(mockType); fail("Expected a " + NullPointerException.class); } catch (final NullPointerException expected) { assertEquals("Cannot locate the type " + typeName, expected.getMessage()); } }