### Question:
MetadataService extends PentahoBase { public String listBusinessModelsJson( String domainName ) throws IOException { ModelInfo[] models = listBusinessModels( domainName ); JSONSerializer serializer = new JSONSerializer(); String json = serializer.deepSerialize( models ); 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 testListBusinessModelsJson() { final String expectedBusinessModelsJson = "[{\"class\":\"org.pentaho.platform.dataaccess.metadata.model.impl" + ".ModelInfo\",\"domainId\":\"" + DOMAIN_ID + "\",\"modelDescription\":null,\"modelId\":\"" + LOGICAL_MODEL_ID + "\"," + "\"modelName\":\"" + LOGICAL_MODEL_NAME + "\"},{\"class\":\"org.pentaho.platform.dataaccess.metadata.model.impl" + ".ModelInfo\",\"domainId\":\"" + DOMAIN_ID + "\",\"modelDescription\":null,\"modelId\":\"" + LOGICAL_MODEL_2_ID + "\"," + "\"modelName\":\"" + LOGICAL_MODEL_2_NAME + "\"}]"; try { when( metadataService.listBusinessModels( anyString() ) ).thenCallRealMethod(); when( metadataService.listBusinessModelsJson( anyString() ) ).thenCallRealMethod(); String businessModelsJson = metadataService.listBusinessModelsJson( DOMAIN_ID ); Assert.assertEquals( expectedBusinessModelsJson, businessModelsJson ); } catch ( Exception ex ) { fail(); } }