@Test public void shouldExtractPackage() throws IOException { String packageString = "* along with this program; if not, see<http: + "package org.eclipse.che.ide.util;" + "import junit.framework.Assert;"; assertEquals("org.eclipse.che.ide.util", GeneratorUtils.getClassFQN("dummy", packageString)); }
public static String getClassFQN(String fileName, String content) throws IOException { Matcher matcher = GeneratorUtils.PACKAGE_PATTERN.matcher(content); if (!matcher.matches()) { throw new IOException(String.format("Class %s doesn't seem to be valid. Package declaration is missing.", fileName)); } if (matcher.groupCount() != 1) { throw new IOException(String.format("Class %s doesn't seem to be valid. Package declaration is missing.", fileName)); } return matcher.group(1); }
GeneratorUtils { public static String getClassFQN(String fileName, String content) throws IOException { Matcher matcher = GeneratorUtils.PACKAGE_PATTERN.matcher(content); if (!matcher.matches()) { throw new IOException(String.format("Class %s doesn't seem to be valid. Package declaration is missing.", fileName)); } if (matcher.groupCount() != 1) { throw new IOException(String.format("Class %s doesn't seem to be valid. Package declaration is missing.", fileName)); } return matcher.group(1); } }
GeneratorUtils { public static String getClassFQN(String fileName, String content) throws IOException { Matcher matcher = GeneratorUtils.PACKAGE_PATTERN.matcher(content); if (!matcher.matches()) { throw new IOException(String.format("Class %s doesn't seem to be valid. Package declaration is missing.", fileName)); } if (matcher.groupCount() != 1) { throw new IOException(String.format("Class %s doesn't seem to be valid. Package declaration is missing.", fileName)); } return matcher.group(1); }  }
GeneratorUtils { public static String getClassFQN(String fileName, String content) throws IOException { Matcher matcher = GeneratorUtils.PACKAGE_PATTERN.matcher(content); if (!matcher.matches()) { throw new IOException(String.format("Class %s doesn't seem to be valid. Package declaration is missing.", fileName)); } if (matcher.groupCount() != 1) { throw new IOException(String.format("Class %s doesn't seem to be valid. Package declaration is missing.", fileName)); } return matcher.group(1); }  static String getClassFQN(String fileName, String content); }
GeneratorUtils { public static String getClassFQN(String fileName, String content) throws IOException { Matcher matcher = GeneratorUtils.PACKAGE_PATTERN.matcher(content); if (!matcher.matches()) { throw new IOException(String.format("Class %s doesn't seem to be valid. Package declaration is missing.", fileName)); } if (matcher.groupCount() != 1) { throw new IOException(String.format("Class %s doesn't seem to be valid. Package declaration is missing.", fileName)); } return matcher.group(1); }  static String getClassFQN(String fileName, String content); static final String ROOT_DIR_PARAMETER; static final Pattern PACKAGE_PATTERN; static final String TAB; static final String TAB2; }