Source:
<code>public void Test_Fields_without_contenttype_on_saving() throws Exception { ContentTypeAPI ctApi = APILocator.getContentTypeAPI(APILocator.systemUser()); ImmutableSimpleContentType.Builder builder = ImmutableSimpleContentType.builder(); ContentType movie = builder.name("Movie").folder(APILocator.systemHost().getFolder()).build(); <START> movie = ctApi.save(movie); <END> ImmutableTextField imdbid = ImmutableTextField.builder().name("imdbid").required(true).unique(true).build(); ImmutableTextField title = ImmutableTextField.builder().name("Title").indexed(true).required(true).build(); ImmutableDateField releaseDate = ImmutableDateField.builder().name("Release Date").variable("releaseDate").build(); ImmutableTextField poster = ImmutableTextField.builder().name("Poster").build(); ImmutableTextField runtime = ImmutableTextField.builder().name("Runtime").build(); ImmutableTextAreaField plot = ImmutableTextAreaField.builder().name("Plot").build(); ImmutableTextField boxOffice = ImmutableTextField.builder().name("Box Office").variable("boxOffice").build(); List<Field> fieldList = new ArrayList<>(); fieldList.add(imdbid); fieldList.add(title); fieldList.add(releaseDate); fieldList.add(poster); fieldList.add(runtime); fieldList.add(plot); fieldList.add(boxOffice); try { ctApi.save(movie, fieldList); final List<Field> fieldsRecovery = APILocator.getContentTypeFieldAPI().byContentTypeId(movie.id()); for (final Field field : fieldsRecovery) { assertEquals(movie.id(), field.contentTypeId()); } } catch (Exception e) { fail("Should work"); } }</code><technical_language>remove this save for test</technical_language>

Target:
public void Test_Fields_without_contenttype_on_saving() throws Exception { ContentTypeAPI ctApi = APILocator.getContentTypeAPI(APILocator.systemUser()); ImmutableSimpleContentType.Builder builder = ImmutableSimpleContentType.builder(); ContentType movie = builder.name("Movie").folder(APILocator.systemHost().getFolder()).build(); try { movie = ctApi.save(movie); ImmutableTextField imdbid = ImmutableTextField.builder().name("imdbid").required(true).unique(true).build(); ImmutableTextField title = ImmutableTextField.builder().name("Title").indexed(true).required(true).build(); ImmutableDateField releaseDate = ImmutableDateField.builder().name("Release Date").variable("releaseDate").build(); ImmutableTextField poster = ImmutableTextField.builder().name("Poster").build(); ImmutableTextField runtime = ImmutableTextField.builder().name("Runtime").build(); ImmutableTextAreaField plot = ImmutableTextAreaField.builder().name("Plot").build(); ImmutableTextField boxOffice = ImmutableTextField.builder().name("Box Office").variable("boxOffice").build(); List<Field> fieldList = new ArrayList<>(); fieldList.add(imdbid); fieldList.add(title); fieldList.add(releaseDate); fieldList.add(poster); fieldList.add(runtime); fieldList.add(plot); fieldList.add(boxOffice); ctApi.save(movie, fieldList); final List<Field> fieldsRecovery = APILocator.getContentTypeFieldAPI().byContentTypeId(movie.id()); for (final Field field : fieldsRecovery) { assertEquals(movie.id(), field.contentTypeId()); } } catch (Exception e) { fail("Should work"); } finally { ctApi.delete(movie); } }