### Question:
AndroidImportOrganizer implements ImportOrganizer { @Override public OrganizedImports organizeImports(List<Import> imports) { OrganizedImports organized = new OrganizedImports(); Map<Boolean, List<Import>> partionedByStatic = imports.stream().collect(Collectors.partitioningBy(Import::isStatic)); for (Boolean key : order.groupOrder()) { organizePartition(organized, partionedByStatic.get(key)); } return organized; } AndroidImportOrganizer(StaticOrder order); @Override OrganizedImports organizeImports(List<Import> imports);  }### Answer:
@Test public void testStaticFirstOrdering() { AndroidImportOrganizer organizer = new AndroidImportOrganizer(StaticOrder.STATIC_FIRST); ImportOrganizer.OrganizedImports organized = organizer.organizeImports(IMPORTS); assertThat(organized.asImportBlock()) .isEqualTo( "import static android.foo.bar;\n" + "\n" + "import static com.android.blah.blah;\n" + "\n" + "import static net.wilma.flintstone;\n" + "\n" + "import static unknown.fred.flintstone;\n" + "\n" + "import static java.ping.pong;\n" + "\n" + "import static javax.pong.ping;\n" + "\n" + "import android.foo;\n" + "\n" + "import com.android.blah;\n" + "\n" + "import net.wilma;\n" + "\n" + "import unknown.barney;\n" + "import unknown.fred;\n" + "\n" + "import java.ping;\n" + "\n" + "import javax.pong;\n"); }
@Test public void testStaticLastOrdering() { AndroidImportOrganizer organizer = new AndroidImportOrganizer(StaticOrder.STATIC_LAST); ImportOrganizer.OrganizedImports organized = organizer.organizeImports(IMPORTS); assertThat(organized.asImportBlock()) .isEqualTo( "import android.foo;\n" + "\n" + "import com.android.blah;\n" + "\n" + "import net.wilma;\n" + "\n" + "import unknown.barney;\n" + "import unknown.fred;\n" + "\n" + "import java.ping;\n" + "\n" + "import javax.pong;\n" + "\n" + "import static android.foo.bar;\n" + "\n" + "import static com.android.blah.blah;\n" + "\n" + "import static net.wilma.flintstone;\n" + "\n" + "import static unknown.fred.flintstone;\n" + "\n" + "import static java.ping.pong;\n" + "\n" + "import static javax.pong.ping;\n"); }