### Question:
MetadataService extends PentahoBase { public String loadModelJson( String domainId, String modelId ) { Model model = loadModel( domainId, modelId ); JSONSerializer serializer = new JSONSerializer(); String json = serializer.deepSerialize( model ); return json; } MetadataService(); @GET @Path( "/getDatasourcePermissions" ) @Produces( { APPLICATION_JSON } ) String getDatasourcePermissions(); ModelInfo[] listBusinessModels( String domainName ); String listBusinessModelsJson( String domainName ); Model loadModel( String domainId, String modelId ); String loadModelJson( String domainId, String modelId ); MarshallableResultSet doQuery( Query query, Integer rowLimit ); MarshallableResultSet doXmlQuery( String xml, Integer rowLimit ); String doXmlQueryToJson( String xml, int rowLimit ); String doXmlQueryToCdaJson( String xml, int rowLimit ); MarshallableResultSet doJsonQuery( String json, Integer rowLimit ); String doJsonQueryToJson( String json, int rowLimit ); String doJsonQueryToCdaJson( String json, int rowLimit ); @Override Log getLogger();  }### Answer:
@Test public void testLoadModelJson() { final String expectedModelJson = "{\"categories\":[{\"class\":\"org.pentaho.platform.dataaccess.metadata.model.impl" + ".Category\",\"columns\":[],\"id\":\"" + CATEGORY_ID + "\",\"name\":null}],\"class\":\"org.pentaho.platform" + ".dataaccess.metadata.model.impl.Model\",\"description\":null,\"domainId\":\"" + DOMAIN_ID + "\",\"id\":\"" + LOGICAL_MODEL_ID + "\",\"name\":\"" + LOGICAL_MODEL_NAME + "\"}"; when( metadataService.loadModel( anyString(), anyString() ) ).thenCallRealMethod(); when( metadataService.loadModelJson( anyString(), anyString() ) ).thenCallRealMethod(); String modelJson = metadataService.loadModelJson( DOMAIN_ID, LOGICAL_MODEL_ID ); Assert.assertEquals( expectedModelJson, modelJson ); }