### Question:
SchemaBuilder { public String buildFor(final String localPart) { return classTypeDiscoverer.getBy(localPart).toSchema(); } SchemaBuilder(ClassTypeDiscoverer classTypeDiscoverer); String buildFor(final String localPart);  }### Answer:
@Test public void givenExistingLocalPart_whenBuildSchema_thenReturnSchema() { final ClassType classTypeDummy = mock(ClassType.class); doReturn("dummy schema").when(classTypeDummy).toSchema(); doReturn(classTypeDummy).when(classTypeDiscovererMock).getBy("dummyLocalPart"); assertThat(schemaBuilder.buildFor("dummyLocalPart"), Matchers.is("dummy schema")); }
@Test(expected = ClassTypeNotFoundException.class) public void givenNonExistingLocalPart_whenBuildSchema_thenThrowException() { doThrow(new ClassTypeNotFoundException()).when(classTypeDiscovererMock).getBy("nonExistingLocalPart"); schemaBuilder.buildFor("nonExistingLocalPart"); }